Class ByteArrayPool
java.lang.Object
org.apache.mina.util.byteaccess.ByteArrayPool
- All Implemented Interfaces:
ByteArrayFactory
Creates
ByteArrays, using a pool to reduce allocation where possible.
WARNING: This code has never been run!-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate intprivate booleanprivate longprivate final intprivate final intprivate final int -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayPool(boolean direct, int maxFreeBuffers, int maxFreeMemory) Creates a new instance of ByteArrayPool. -
Method Summary
-
Field Details
-
MAX_BITS
private final int MAX_BITS- See Also:
-
freed
private boolean freed -
direct
private final boolean direct -
freeBuffers
-
freeBufferCount
private int freeBufferCount -
freeMemory
private long freeMemory -
maxFreeBuffers
private final int maxFreeBuffers -
maxFreeMemory
private final int maxFreeMemory
-
-
Constructor Details
-
ByteArrayPool
public ByteArrayPool(boolean direct, int maxFreeBuffers, int maxFreeMemory) Creates a new instance of ByteArrayPool.- Parameters:
direct- If we should use direct buffersmaxFreeBuffers- The maximum number of free buffersmaxFreeMemory- The maximum amount of free memory allowed
-
-
Method Details
-
create
Creates a new instance of aByteArray- Specified by:
createin interfaceByteArrayFactory- Parameters:
size- The size of the array to build- Returns:
- The ByteArray
-
bits
private int bits(int index) -
free
public void free()Frees the buffers
-