rabbit.io
Interface BufferHandler

All Known Implementing Classes:
CachingBufferHandler

public interface BufferHandler

A ByteBuffer handler

Author:
Robert Olofsson

Method Summary
 java.nio.ByteBuffer getBuffer()
          Get a byte buffer of reasonable size, the buffer will have been cleared.
 java.nio.ByteBuffer growBuffer(java.nio.ByteBuffer buffer)
          Get a larger buffer with the same contents as buffer, this will also return buffer to the pool.
 boolean isLarge(java.nio.ByteBuffer buffer)
          Check if the given buffer is a large buffer
 void putBuffer(java.nio.ByteBuffer buffer)
          Return a buffer.
 

Method Detail

getBuffer

java.nio.ByteBuffer getBuffer()
Get a byte buffer of reasonable size, the buffer will have been cleared.

Returns:
a ByteBuffer

putBuffer

void putBuffer(java.nio.ByteBuffer buffer)
Return a buffer.

Parameters:
buffer - the ByteBuffer to return to the cache

growBuffer

java.nio.ByteBuffer growBuffer(java.nio.ByteBuffer buffer)
Get a larger buffer with the same contents as buffer, this will also return buffer to the pool.

Parameters:
buffer - an existing buffer, the contents will be copied into the new larger buffer. May be null.
Returns:
the new larger buffer

isLarge

boolean isLarge(java.nio.ByteBuffer buffer)
Check if the given buffer is a large buffer

Parameters:
buffer - the ByteBuffer to check
Returns:
true if the given buffer is large