public class ByteBufferPool
extends java.lang.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
|
java.lang.String |
toString()
Return the byte buffer pool details as a string
|
public ByteBufferPool(int[] bufSizes, int[] initAlloc, int[] maxAlloc)
Buffer
- sizes int[]Initial
- allocations for each size int[]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()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.