TCByteBuffer source that hides JDK dependencies and that can pool instances. Instance pooling is likely to be a good
idea for fixed size buffers and definitely a good idea for java 1.4 direct buffers (since their
allocation/deallication is more expensive than regular java objects).
author: teck
getFixedSizedInstancesForLength(boolean direct, int length) Get enough fixed sized TCByteBuffer instances to contain the given number of bytes
Parameters: direct - True to hint that the buffers should be direct buffers (ie.
getInstance(boolean direct, int size) Get a single variable sized TCByteBuffer instance Note: These are not pooled (yet)
Parameters: size - The desired minimum capacity of the buffer.
public static TCByteBuffer[] getFixedSizedInstancesForLength(boolean direct, int length)(Code)
Get enough fixed sized TCByteBuffer instances to contain the given number of bytes
Parameters: direct - True to hint that the buffers should be direct buffers (ie. not on the Java heap). Direct bufferswill never be returned if this parameter is false. Direct buffers may or MAY NOT returned if the parameteris true. The returned buffers may be a mix of direct and non-direct Parameters: length - an array of TCByteBuffer instances (with length always >= 1). The limit of the last buffer may be less thenit's capacity to adjust for the given length
Get a single variable sized TCByteBuffer instance Note: These are not pooled (yet)
Parameters: size - The desired minimum capacity of the buffer. The actual capacity may be higher. The buffer's limit willbe equal to it's capacity. Parameters: direct - True to hint that the buffer should be a direct buffer (ie. not on the Java heap). A direct bufferwill never be returned if this parameter is false. A direct buffer may or MAY NOT returned if the parameteris true TODO :: Make this the only interface and make it return fixed size buffer also make sure onlyfixedBufferSize gets to the pool back.