public abstract class AbstractByteSource extends java.lang.Object implements ByteSource
ByteSource. This class
implements some common methods that most classes will not want to override.
In particular, it maps all get methods without an offset to their counterpart
with an offset, so that the number of methods to implement is reduced.ByteSource.AtomicGetOperation<T>| Modifier and Type | Field and Description |
|---|---|
protected static int |
SIZE_OF_BYTE
Size of a byte in bytes.
|
protected static int |
SIZE_OF_DOUBLE
Size of a double in bytes.
|
protected static int |
SIZE_OF_FLOAT
Size of a float in bytes.
|
protected static int |
SIZE_OF_INT
Size of an int in bytes.
|
protected static int |
SIZE_OF_LONG
Size of a long in bytes.
|
protected static int |
SIZE_OF_SHORT
Size of a short in bytes.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractByteSource()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
byte |
getByte()
Reads a single byte and advances the current position.
|
byte[] |
getByteArray(int length)
Reads the specified number of bytes and advances the current position.
|
double |
getDouble()
Reads a single double and advances the current position.
|
AbstractByteSource |
getDoubleArray(double[] destination,
int offset,
int length)
Reads the specified number of double values into the supplied array and
advances the current position.
|
double[] |
getDoubleArray(int length)
Reads the specified number of doubles and advances the current position.
|
float |
getFloat()
Reads a single float and advances the current position.
|
AbstractByteSource |
getFloatArray(float[] destination,
int offset,
int length)
Reads the specified number of float values into the supplied array and
advances the current position.
|
float[] |
getFloatArray(int length)
Reads the specified number of floats and advances the current position.
|
int |
getInt()
Reads a single int and advances the current position.
|
int[] |
getIntArray(int length)
Reads the specified number of ints and advances the current position.
|
AbstractByteSource |
getIntArray(int[] destination,
int offset,
int length)
Reads the specified number of int values into the supplied array and
advances the current position.
|
long |
getLong()
Reads a single long and advances the current position.
|
long[] |
getLongArray(int length)
Reads the specified number of longs and advances the current position.
|
AbstractByteSource |
getLongArray(long[] destination,
int offset,
int length)
Reads the specified number of long values into the supplied array and
advances the current position.
|
short |
getShort()
Reads a single short and advances the current position.
|
short[] |
getShortArray(int length)
Reads the specified number of shorts and advances the current position.
|
AbstractByteSource |
getShortArray(short[] destination,
int offset,
int length)
Reads the specified number of short values into the supplied array and
advances the current position.
|
java.lang.String |
toString()
Returns a string representation of this byte source.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitatomicGet, getByteArray, remaining, skipprotected static final int SIZE_OF_BYTE
protected static final int SIZE_OF_DOUBLE
protected static final int SIZE_OF_FLOAT
protected static final int SIZE_OF_INT
protected static final int SIZE_OF_LONG
protected static final int SIZE_OF_SHORT
protected AbstractByteSource()
public byte getByte()
ByteSourcegetByte in interface ByteSourcepublic byte[] getByteArray(int length)
ByteSourcethis.getByteArray(new byte[length], 0, length).getByteArray in interface ByteSourcelength - number of bytes to be read.public double getDouble()
ByteSourcegetDouble in interface ByteSourcepublic double[] getDoubleArray(int length)
ByteSourcethis.getDoubleArray(new double[length], 0, length).getDoubleArray in interface ByteSourcelength - number of doubles to be read.public AbstractByteSource getDoubleArray(double[] destination, int offset, int length)
ByteSourcegetDoubleArray in interface ByteSourcedestination - array into which the read values are copied. This array's
length must be at least
length + destinationOffset.offset - offset into the destination array. The destination array is
filled starting at this position.length - number of values to be read.public float getFloat()
ByteSourcegetFloat in interface ByteSourcepublic float[] getFloatArray(int length)
ByteSourcethis.getFloatArray(new float[length], 0, length).getFloatArray in interface ByteSourcelength - number of floats to be read.public AbstractByteSource getFloatArray(float[] destination, int offset, int length)
ByteSourcegetFloatArray in interface ByteSourcedestination - array into which the read values are copied. This array's
length must be at least
length + destinationOffset.offset - offset into the destination array. The destination array is
filled starting at this position.length - number of values to be read.public int getInt()
ByteSourcegetInt in interface ByteSourcepublic int[] getIntArray(int length)
ByteSourcethis.getIntArray(new int[length], 0, length).getIntArray in interface ByteSourcelength - number of ints to be read.public AbstractByteSource getIntArray(int[] destination, int offset, int length)
ByteSourcegetIntArray in interface ByteSourcedestination - array into which the read values are copied. This array's
length must be at least
length + destinationOffset.offset - offset into the destination array. The destination array is
filled starting at this position.length - number of values to be read.public long getLong()
ByteSourcegetLong in interface ByteSourcepublic long[] getLongArray(int length)
ByteSourcethis.getLongArray(new long[length], 0, length).getLongArray in interface ByteSourcelength - number of longs to be read.public AbstractByteSource getLongArray(long[] destination, int offset, int length)
ByteSourcegetLongArray in interface ByteSourcedestination - array into which the read values are copied. This array's
length must be at least
length + destinationOffset.offset - offset into the destination array. The destination array is
filled starting at this position.length - number of values to be read.public short getShort()
ByteSourcegetShort in interface ByteSourcepublic short[] getShortArray(int length)
ByteSourcethis.getShortArray(new short[length], 0, length).getShortArray in interface ByteSourcelength - number of shorts to be read.public AbstractByteSource getShortArray(short[] destination, int offset, int length)
ByteSourcegetShortArray in interface ByteSourcedestination - array into which the read values are copied. This array's
length must be at least
length + destinationOffset.offset - offset into the destination array. The destination array is
filled starting at this position.length - number of values to be read.public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2014–2018 aquenos GmbH. All rights reserved.