rabbit.io
Class SimpleBufferHandle

java.lang.Object
  extended by rabbit.io.SimpleBufferHandle
All Implemented Interfaces:
BufferHandle

public class SimpleBufferHandle
extends Object
implements BufferHandle

A handle to a ByteBuffer.

Author:
Robert Olofsson

Constructor Summary
SimpleBufferHandle(ByteBuffer buffer)
           
 
Method Summary
 ByteBuffer getBuffer()
          Get a byte buffer of reasonable size, the buffer will have been cleared.
 ByteBuffer getLargeBuffer()
          Get a byte buffer of reasonable size, the buffer will have been cleared.
 boolean isEmpty()
          Check if this handle is empty, that is if no buffer exists or the buffer is empty.
 void possiblyFlush()
          release a buffer if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBufferHandle

public SimpleBufferHandle(ByteBuffer buffer)
Method Detail

isEmpty

public boolean isEmpty()
Description copied from interface: BufferHandle
Check if this handle is empty, that is if no buffer exists or the buffer is empty.

Specified by:
isEmpty in interface BufferHandle

getBuffer

public ByteBuffer getBuffer()
Description copied from interface: BufferHandle
Get a byte buffer of reasonable size, the buffer will have been cleared.

Specified by:
getBuffer in interface BufferHandle

getLargeBuffer

public ByteBuffer getLargeBuffer()
Description copied from interface: BufferHandle
Get a byte buffer of reasonable size, the buffer will have been cleared.

Specified by:
getLargeBuffer in interface BufferHandle

possiblyFlush

public void possiblyFlush()
Description copied from interface: BufferHandle
release a buffer if possible.

Specified by:
possiblyFlush in interface BufferHandle