public class TempBuffer
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
LARGE_SIZE |
static int |
SIZE |
static int |
SMALL_SIZE |
Constructor and Description |
---|
TempBuffer(int size)
Create a new TempBuffer.
|
Modifier and Type | Method and Description |
---|---|
static TempBuffer |
allocate()
Allocate a TempBuffer, reusing one if available.
|
static TempBuffer |
allocateLarge()
Allocate a TempBuffer, reusing one if available.
|
static TempBuffer |
allocateSmall()
Allocate a TempBuffer, reusing one if available.
|
void |
clear()
Clears the buffer.
|
static void |
clearFreeLists()
Called on OOM to free buffers.
|
static void |
free(TempBuffer buf)
Frees a single buffer.
|
static void |
freeAll(TempBuffer buf) |
static void |
freeAllLarge(TempBuffer buf) |
static void |
freeAllSmall(TempBuffer buf) |
static void |
freeLarge(TempBuffer buf)
Frees a single buffer.
|
void |
freeSelf() |
static void |
freeSmall(TempBuffer buf)
Frees a single buffer.
|
int |
getAvailable() |
byte[] |
getBuffer()
Returns the buffer's underlying byte array.
|
int |
getCapacity() |
int |
getLength()
Returns the number of bytes in the buffer.
|
TempBuffer |
getNext() |
static boolean |
isSmallmem()
Returns true for a smallmem configuration
|
void |
setLength(int length)
Sets the number of bytes used in the buffer.
|
void |
setNext(TempBuffer next) |
int |
write(byte[] buf,
int offset,
int length) |
public static final int SMALL_SIZE
public static final int LARGE_SIZE
public static final int SIZE
public static boolean isSmallmem()
public static TempBuffer allocate()
public static TempBuffer allocateSmall()
public static TempBuffer allocateLarge()
public void clear()
public final byte[] getBuffer()
public final int getLength()
public final void setLength(int length)
public final int getCapacity()
public int getAvailable()
public final TempBuffer getNext()
public final void setNext(TempBuffer next)
public int write(byte[] buf, int offset, int length)
public void freeSelf()
public static void free(TempBuffer buf)
public static void freeAll(TempBuffer buf)
public static void freeSmall(TempBuffer buf)
public static void freeAllSmall(TempBuffer buf)
public static void freeLarge(TempBuffer buf)
public static void freeAllLarge(TempBuffer buf)
public static void clearFreeLists()