com.sun.grizzly.memory
Interface WrapperAware<E extends Buffer>

All Known Implementing Classes:
ByteBufferManager, ByteBufferViewManager, DefaultMemoryManager, SlabMemoryManagerBase, SlabMemoryManagerImpl, SlabPoolMemoryManagerImpl

public interface WrapperAware<E extends Buffer>

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
 E wrap(byte[] data)
          Returns Buffer, which wraps the byte array.
 E wrap(byte[] data, int offset, int length)
          Returns Buffer, which wraps the part of byte array with specific offset and length.
 E wrap(ByteBuffer byteBuffer)
          Returns Buffer, which wraps the ByteBuffer.
 E wrap(String s)
          Returns Buffer, which wraps the String.
 E wrap(String s, Charset charset)
          Returns Buffer, which wraps the String with the specific Charset.
 

Method Detail

wrap

E 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

E 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

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

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

wrap

E 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

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

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


Copyright © 2009 SUN Microsystems. All Rights Reserved.