ecologylab.io
Class ByteBufferPool
java.lang.Object
ecologylab.generic.Debug
ecologylab.generic.ResourcePool<T>
ecologylab.generic.ResourcePoolWithSize<java.nio.ByteBuffer>
ecologylab.io.ByteBufferPool
public class ByteBufferPool
- extends ResourcePoolWithSize<java.nio.ByteBuffer>
This class maintains a collection of ByteBuffers, which may be acquir()'ed for temporary use.
- Author:
- Zach Toups (toupsz@gmail.com)
|
Constructor Summary |
ByteBufferPool(int poolSize,
int minimumCapacity,
int maxBufferSize)
Instantiates a new, empty ByteBufferPool. |
|
Method Summary |
protected void |
clean(java.nio.ByteBuffer objectToClean)
Ensure that the given Object is "clean", that is, in the state it would be in if it were just instantiated. |
protected java.nio.ByteBuffer |
generateNewResource()
Instantiates a resource of type T. |
static void |
main(java.lang.String[] args)
|
| Methods inherited from class ecologylab.generic.Debug |
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ByteBufferPool
public ByteBufferPool(int poolSize,
int minimumCapacity,
int maxBufferSize)
- Instantiates a new, empty ByteBufferPool.
- Parameters:
maxBufferSize - -
specifies the size of the (immutable) ByteBuffers that will be created within this pool.
clean
protected void clean(java.nio.ByteBuffer objectToClean)
- Description copied from class:
ResourcePool
- Ensure that the given Object is "clean", that is, in the state it would be in if it were just instantiated. For
example, if this class were handling StringBuilders, it should ensure that the StringBuilder does not contain any
characters from a previous use.
clean(T) is automatically called immediately before an object is returned from the acquire() method.
- Specified by:
clean in class ResourcePool<java.nio.ByteBuffer>
- See Also:
ResourcePool.clean(java.lang.Object)
generateNewResource
protected java.nio.ByteBuffer generateNewResource()
- Description copied from class:
ResourcePool
- Instantiates a resource of type T.
- Specified by:
generateNewResource in class ResourcePool<java.nio.ByteBuffer>
- Returns:
- See Also:
ResourcePool.generateNewResource()
main
public static void main(java.lang.String[] args)