org.szegedi.nbpipe
Class GlobalByteBufferPool
java.lang.Object
|
+--org.szegedi.nbpipe.GlobalByteBufferPool
- All Implemented Interfaces:
- ByteBufferPool
- public class GlobalByteBufferPool
- extends java.lang.Object
- implements ByteBufferPool
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GlobalByteBufferPool
public GlobalByteBufferPool(int memorySize,
int fileSize,
java.io.File file)
throws java.io.IOException
setBlockingWhenExhausted
public void setBlockingWhenExhausted(boolean blocking)
isBlockingWhenExhausted
public boolean isBlockingWhenExhausted()
getMemoryBuffer
public java.nio.ByteBuffer getMemoryBuffer()
- Description copied from interface:
ByteBufferPool
- Returns a buffer from this pool. The method first attempts to
return a memory buffer. If one is not available, it attempts to
return a file buffer. If neither a file buffer is available, it
will (depending on whether the pool blocks when exhausted) block
while a memory buffer becomes available, or allocate a new, non-direct,
one-shot memory buffer from the heap.
- Specified by:
getMemoryBuffer in interface ByteBufferPool
getFileBuffer
public java.nio.ByteBuffer getFileBuffer()
- Description copied from interface:
ByteBufferPool
- Returns a buffer from this pool. The method first attempts to
return a file buffer. If one is not available, it attempts to
return a memory buffer. If neither a memory buffer is available, it
will (depending on whether the pool blocks when exhausted) block
while a file buffer becomes available, or allocate a new, non-direct,
one-shot memory buffer from the heap.
- Specified by:
getFileBuffer in interface ByteBufferPool
putBuffer
public void putBuffer(java.nio.ByteBuffer buffer)
- Description copied from interface:
ByteBufferPool
- Returns a buffer to this pool. If the buffer is a non-direct buffer,
it should be ignored. If the buffer is a direct buffer, but is
recognized as not belonging to this pool, an IllegalArgumentException
should be thrown.
- Specified by:
putBuffer in interface ByteBufferPool
getBufferType
public int getBufferType(java.nio.ByteBuffer buffer)
- Specified by:
getBufferType in interface ByteBufferPool