public class FastByteBuffer extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
SIZE_OF_BOOLEAN |
static long |
SIZE_OF_BYTE |
static long |
SIZE_OF_DOUBLE |
static long |
SIZE_OF_FLOAT |
static long |
SIZE_OF_INT |
static long |
SIZE_OF_LONG |
static long |
SIZE_OF_SHORT |
| Constructor and Description |
|---|
FastByteBuffer()
construct new FastByteBuffer
|
FastByteBuffer(byte[] buffer,
int size)
construct new FastByteBuffer
|
FastByteBuffer(int size)
construct new FastByteBuffer
|
| Modifier and Type | Method and Description |
|---|---|
static void |
copyMemory(Object srcBase,
long srcOffset,
Object destBase,
long destOffset,
long bytes) |
byte[] |
elements() |
void |
ensureAdditionalCapacity(long capacity) |
void |
ensureCapacity(int capacity) |
void |
forceCapacity(int length,
int preserve)
Forces FastByteBUffer to contain the given number of entries, preserving
just a part of the array.
|
boolean |
getBoolean() |
boolean[] |
getBooleanArray() |
byte |
getByte() |
byte[] |
getByteArray() |
int |
getCapacity() |
double |
getDouble() |
double[] |
getDoubleArray() |
float |
getFloat() |
float[] |
getFloatArray() |
int |
getInt() |
int[] |
getIntArray() |
long |
getLong() |
long[] |
getLongArray() |
long |
getPosition() |
short |
getShort() |
short[] |
getShortArray() |
String |
getString() |
String[] |
getStringArray() |
void |
putBoolean(boolean value) |
void |
putBooleanArray(boolean[] values) |
void |
putBooleanArray(boolean[] values,
int nToCopy) |
void |
putByte(byte value) |
void |
putByteArray(byte[] values) |
void |
putByteArray(byte[] values,
int nToCopy) |
void |
putDouble(double value) |
void |
putDoubleArray(double[] values) |
void |
putDoubleArray(double[] values,
int nToCopy) |
void |
putFloat(float value) |
void |
putFloatArray(float[] values) |
void |
putFloatArray(float[] values,
int nToCopy) |
void |
putInt(int value) |
void |
putIntArray(int[] values) |
void |
putIntArray(int[] values,
int nToCopy) |
void |
putLong(long value) |
void |
putLongArray(long[] values) |
void |
putLongArray(long[] values,
int nToCopy) |
void |
putShort(short value) |
void |
putShortArray(short[] values) |
void |
putShortArray(short[] values,
int nToCopy) |
void |
putString(String string) |
void |
putStringArray(String[] values) |
void |
putStringArray(String[] values,
int nToCopy) |
void |
reset() |
void |
trim()
Trims the internal buffer array so that the capacity is equal to the
size.
|
void |
trim(int requestedCapacity)
Trims the internal buffer array if it is too large.
|
boolean |
verifySize() |
static FastByteBuffer |
wrap(byte[] byteArray)
Wraps a given byte array into FastByteBuffer
|
static FastByteBuffer |
wrap(byte[] byteArray,
int length)
Wraps a given byte array into FastByteBuffer
|
public static final long SIZE_OF_BOOLEAN
public static final long SIZE_OF_BYTE
public static final long SIZE_OF_SHORT
public static final long SIZE_OF_INT
public static final long SIZE_OF_LONG
public static final long SIZE_OF_FLOAT
public static final long SIZE_OF_DOUBLE
public FastByteBuffer()
public FastByteBuffer(int size)
size - initial capacity of the bufferpublic FastByteBuffer(byte[] buffer,
int size)
buffer - buffer to initialise/re-usesize - position until buffer is filledpublic static void copyMemory(Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes)
public static FastByteBuffer wrap(byte[] byteArray, int length)
Note it is guaranteed that the type of the array returned by
elements() will be the same.
byteArray - an array to wrap.length - the length of the resulting array list.public static FastByteBuffer wrap(byte[] byteArray)
Note it is guaranteed that the type of the array returned by
elements() will be the same.
byteArray - an array to wrap.public byte[] elements()
public long getPosition()
public int getCapacity()
public void reset()
public boolean verifySize()
public void forceCapacity(int length,
int preserve)
length - the new minimum length for this array.preserve - the number of elements of the old buffer that shall be
preserved in case a new allocation is necessary.public void ensureCapacity(int capacity)
public void ensureAdditionalCapacity(long capacity)
public void trim()
ArrayList.trimToSize()public void trim(int requestedCapacity)
n, this
method does nothing. Otherwise, it trims the array length to the maximum
between requestedCapacity and getCapacity().
This method is useful when reusing FastBuffers. Clearing a list leaves the array length untouched. If you are reusing a list many times, you can call this method with a typical size to avoid keeping around a very large array just because of a few large transient lists.
requestedCapacity - the threshold for the trimming.public void putBoolean(boolean value)
public boolean getBoolean()
public void putByte(byte value)
public byte getByte()
public void putShort(short value)
public short getShort()
public void putInt(int value)
public int getInt()
public void putLong(long value)
public long getLong()
public void putFloat(float value)
public float getFloat()
public void putDouble(double value)
public double getDouble()
public void putBooleanArray(boolean[] values)
public void putBooleanArray(boolean[] values,
int nToCopy)
public boolean[] getBooleanArray()
public void putByteArray(byte[] values)
public void putByteArray(byte[] values,
int nToCopy)
public byte[] getByteArray()
public void putShortArray(short[] values)
public void putShortArray(short[] values,
int nToCopy)
public short[] getShortArray()
public void putIntArray(int[] values)
public void putIntArray(int[] values,
int nToCopy)
public int[] getIntArray()
public void putLongArray(long[] values)
public void putLongArray(long[] values,
int nToCopy)
public long[] getLongArray()
public void putFloatArray(float[] values)
public void putFloatArray(float[] values,
int nToCopy)
public float[] getFloatArray()
public void putDoubleArray(double[] values)
public void putDoubleArray(double[] values,
int nToCopy)
public double[] getDoubleArray()
public void putString(String string)
public String getString()
public void putStringArray(String[] values)
public void putStringArray(String[] values, int nToCopy)
public String[] getStringArray()
Copyright © 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH. All rights reserved.