public abstract class AbstractByteSink extends Object implements ByteSink
Abstract base class for ByteSink implementations. This base class
implements most of the methods declared in the ByteSink interface.
However, the typed put operations in this class incur an extra copy operation
in order to convert the raw data-type to bytes.
If possible, implementations should override the typed put operations with a more efficient implementation that can write the data type directly. Usually, it is sufficient to override the operations that take an array as well as an offset and length, because those methods a called by the convenience methods that take a single value or an array without additional parameters. However, derived classes are also free to override the other methods, if they can provide a more efficient implementation for them.
ByteSink.AtomicPutOperation<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 |
AbstractByteSink()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ByteSink |
putByte(byte b)
Writes a single byte to this byte sink.
|
ByteSink |
putByteArray(byte[] source)
Writes a complete array of bytes to this byte sink.
|
ByteSink |
putDouble(double value)
Writes a single double value to this byte sink.
|
ByteSink |
putDoubleArray(double[] source)
Writes a complete array of double values to this byte sink.
|
ByteSink |
putDoubleArray(double[] source,
int offset,
int length)
Writes a slice of an array of double values to this byte sink.
|
ByteSink |
putFloat(float value)
Writes a single float value to this byte sink.
|
ByteSink |
putFloatArray(float[] source)
Writes a complete array of float values to this byte sink.
|
ByteSink |
putFloatArray(float[] source,
int offset,
int length)
Writes a slice of an array of float values to this byte sink.
|
ByteSink |
putInt(int value)
Writes a single int value to this byte sink.
|
ByteSink |
putIntArray(int[] source)
Writes a complete array of int values to this byte sink.
|
ByteSink |
putIntArray(int[] source,
int offset,
int length)
Writes a slice of an array of int values to this byte sink.
|
ByteSink |
putLong(long value)
Writes a single long value to this byte sink.
|
ByteSink |
putLongArray(long[] source)
Writes a complete array of long values to this byte sink.
|
ByteSink |
putLongArray(long[] source,
int offset,
int length)
Writes a slice of an array of long values to this byte sink.
|
ByteSink |
putShort(short value)
Writes a single short value to this byte sink.
|
ByteSink |
putShortArray(short[] source)
Writes a complete array of short values to this byte sink.
|
ByteSink |
putShortArray(short[] source,
int offset,
int length)
Writes a slice of an array of short values to this byte sink.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitatomicPut, putByteArrayprotected 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 AbstractByteSink()
public ByteSink putByte(byte b)
ByteSinkpublic ByteSink putByteArray(byte[] source)
ByteSinkputByteArray in interface ByteSinksource - array of bytes that should be completely written to this byte
sink.public ByteSink putDouble(double value)
ByteSinkpublic ByteSink putDoubleArray(double[] source)
ByteSinkputDoubleArray in interface ByteSinksource - array of double values that should be completely written to
this byte sink.public ByteSink putDoubleArray(double[] source, int offset, int length)
ByteSinkputDoubleArray in interface ByteSinksource - array of double values that should be partially written to
this byte sink.offset - offset into source. Data will be read from the
array starting at this index.length - number of values to be written.public ByteSink putFloat(float value)
ByteSinkpublic ByteSink putFloatArray(float[] source)
ByteSinkputFloatArray in interface ByteSinksource - array of float values that should be completely written to
this byte sink.public ByteSink putFloatArray(float[] source, int offset, int length)
ByteSinkputFloatArray in interface ByteSinksource - array of float values that should be partially written to this
byte sink.offset - offset into source. Data will be read from the
array starting at this index.length - number of values to be written.public ByteSink putInt(int value)
ByteSinkpublic ByteSink putIntArray(int[] source)
ByteSinkputIntArray in interface ByteSinksource - array of int values that should be completely written to this
byte sink.public ByteSink putIntArray(int[] source, int offset, int length)
ByteSinkputIntArray in interface ByteSinksource - array of int values that should be partially written to this
byte sink.offset - offset into source. Data will be read from the
array starting at this index.length - number of values to be written.public ByteSink putShort(short value)
ByteSinkpublic ByteSink putShortArray(short[] source)
ByteSinkputShortArray in interface ByteSinksource - array of short values that should be completely written to
this byte sink.public ByteSink putShortArray(short[] source, int offset, int length)
ByteSinkputShortArray in interface ByteSinksource - array of short values that should be partially written to this
byte sink.offset - offset into source. Data will be read from the
array starting at this index.length - number of values to be written.public ByteSink putLong(long value)
ByteSinkpublic ByteSink putLongArray(long[] source)
ByteSinkputLongArray in interface ByteSinksource - array of long values that should be completely written to this
byte sink.public ByteSink putLongArray(long[] source, int offset, int length)
ByteSinkputLongArray in interface ByteSinksource - array of long values that should be partially written to this
byte sink.offset - offset into source. Data will be read from the
array starting at this index.length - number of values to be written.Copyright © 2014–2017 aquenos GmbH. All rights reserved.