public class ByteBufferPool extends Object
Memory pool of different sized byte buffers.
Constructor and Description |
---|
ByteBufferPool(int[] bufSizes,
int[] initAlloc,
int[] maxAlloc)
Class constuctor
|
Modifier and Type | Method and Description |
---|---|
byte[] |
allocateBuffer(int siz)
Allocate a byte buffer from the appropriate buffer list, if there are buffers available then do not wait
|
byte[] |
allocateBuffer(int siz,
long waitTime)
Allocate a byte buffer from the appropriate buffer list
|
ByteBufferList[] |
getBufferList()
Return the buffer list
|
int |
getLargestSize()
Return the length of the largest packet size available
|
int |
getSmallestSize()
Return the length of the smallest packet size available
|
void |
releaseBuffer(byte[] buf)
Release a buffer
|
void |
shrinkLists()
Shrink the buffer lists back to their initial allocation sizes
|
String |
toString()
Return the byte buffer pool details as a string
|
public ByteBufferPool(int[] bufSizes, int[] initAlloc, int[] maxAlloc)
bufSizes
- Buffer sizes int[]initAlloc
- Initial allocations for each size int[]maxAlloc
- Maximim allocations for each size int[]public final byte[] allocateBuffer(int siz)
siz
- intpublic final byte[] allocateBuffer(int siz, long waitTime)
siz
- intwaitTime
- longpublic final void releaseBuffer(byte[] buf)
buf
- byte[]public final void shrinkLists()
public final int getSmallestSize()
public final int getLargestSize()
public final ByteBufferList[] getBufferList()
Copyright © 2005–2018 Alfresco Software. All rights reserved.