org.glassfish.grizzly.memory
Interface WrapperAware

All Known Implementing Classes:
ByteBufferManager, HeapMemoryManager

public interface WrapperAware

MemoryManagers, which implement this interface, are able to convert frequently used Java buffer types to Grizzly Buffer.

Author:
Alexey Stashok
See Also:
MemoryUtils, MemoryManager

Method Summary
 Buffer wrap(byte[] data)
          Returns Buffer, which wraps the byte array.
 Buffer wrap(byte[] data, int offset, int length)
          Returns Buffer, which wraps the part of byte array with specific offset and length.
 Buffer wrap(ByteBuffer byteBuffer)
          Returns Buffer, which wraps the ByteBuffer.
 Buffer wrap(String s)
          Returns Buffer, which wraps the String.
 Buffer wrap(String s, Charset charset)
          Returns Buffer, which wraps the String with the specific Charset.
 

Method Detail

wrap

Buffer wrap(byte[] data)
Returns Buffer, which wraps the byte array.

Parameters:
data - byte array to wrap
Returns:
Buffer wrapper on top of passed byte array.

wrap

Buffer wrap(byte[] data,
            int offset,
            int length)
Returns Buffer, which wraps the part of byte array with specific offset and length.

Parameters:
data - byte array to wrap
offset - byte buffer offset
length - byte buffer length
Returns:
Buffer wrapper on top of passed byte array.

wrap

Buffer wrap(String s)
Returns Buffer, which wraps the String.

Parameters:
s - String
Returns:
Buffer wrapper on top of passed String.

wrap

Buffer wrap(String s,
            Charset charset)
Returns Buffer, which wraps the String with the specific Charset.

Parameters:
s - String
charset - Charset, which will be used, when converting String to byte array.
Returns:
Buffer wrapper on top of passed String.

wrap

Buffer wrap(ByteBuffer byteBuffer)
Returns Buffer, which wraps the ByteBuffer.

Parameters:
byteBuffer - ByteBuffer to wrap
Returns:
Buffer wrapper on top of passed ByteBuffer.


Copyright © 2012 Oracle Corporation. All Rights Reserved.