public abstract class FieldType<T> extends Object
The write(DataOutputExtended, Object) writes out field type and then
the data for that field type. The field type is represented by this
enumberation, with the index being what is written
to the stream (hence of type byte to keep small).
Conversely, the read(DataInputExtended) reads the field type and
then the data for that field type.
| Modifier and Type | Field and Description |
|---|---|
static FieldType<Boolean> |
BOOLEAN |
static FieldType<boolean[]> |
BOOLEAN_ARRAY |
static FieldType<Byte> |
BYTE |
static FieldType<byte[]> |
BYTE_ARRAY |
static FieldType<Character> |
CHAR |
static FieldType<char[]> |
CHAR_ARRAY |
static FieldType<Double> |
DOUBLE |
static FieldType<double[]> |
DOUBLE_ARRAY |
static FieldType<Encodable> |
ENCODABLE |
static FieldType<Encodable[]> |
ENCODABLE_ARRAY |
static FieldType<Float> |
FLOAT |
static FieldType<float[]> |
FLOAT_ARRAY |
static FieldType<Integer> |
INTEGER |
static FieldType<int[]> |
INTEGER_ARRAY |
static FieldType<Long> |
LONG |
static FieldType<long[]> |
LONG_ARRAY |
static FieldType<Serializable> |
SERIALIZABLE |
static FieldType<Serializable[]> |
SERIALIZABLE_ARRAY |
static FieldType<Short> |
SHORT |
static FieldType<short[]> |
SHORT_ARRAY |
static FieldType<String> |
STRING |
static FieldType<String[]> |
STRING_ARRAY |
static FieldType<Integer> |
UNSIGNED_BYTE |
static FieldType<Integer> |
UNSIGNED_SHORT |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checksStream()
Whether this implementation checks ordering in the stream.
|
protected T |
doRead(DataInputExtended input) |
protected <Q> Q[] |
doReadArray(DataInputExtended input,
Class<Q> elementType) |
protected abstract void |
doWrite(DataOutputExtended output,
T value) |
static FieldType<?> |
get(byte idx) |
Class<T> |
getCls() |
byte |
getIdx() |
T |
read(DataInputExtended input) |
<Q> Q[] |
readArray(DataInputExtended input,
Class<Q> elementType) |
String |
toString() |
void |
write(DataOutputExtended output,
T value) |
public static FieldType<boolean[]> BOOLEAN_ARRAY
public static FieldType<byte[]> BYTE_ARRAY
public static FieldType<short[]> SHORT_ARRAY
public static FieldType<Integer> UNSIGNED_BYTE
public static FieldType<Integer> UNSIGNED_SHORT
public static FieldType<int[]> INTEGER_ARRAY
public static FieldType<long[]> LONG_ARRAY
public static FieldType<char[]> CHAR_ARRAY
public static FieldType<float[]> FLOAT_ARRAY
public static FieldType<double[]> DOUBLE_ARRAY
public static FieldType<String[]> STRING_ARRAY
public static FieldType<Encodable[]> ENCODABLE_ARRAY
public static FieldType<Serializable> SERIALIZABLE
public static FieldType<Serializable[]> SERIALIZABLE_ARRAY
public byte getIdx()
protected boolean checksStream()
Broadly, the type safe ones do, the Encodable and
Serializable ones do not.
public final T read(DataInputExtended input) throws IOException
IOExceptionpublic final <Q> Q[] readArray(DataInputExtended input, Class<Q> elementType) throws IOException
IOExceptionpublic final void write(DataOutputExtended output, T value) throws IOException
IOExceptionprotected T doRead(DataInputExtended input) throws IOException
IOExceptionprotected <Q> Q[] doReadArray(DataInputExtended input, Class<Q> elementType) throws IOException
IOExceptionprotected abstract void doWrite(DataOutputExtended output, T value) throws IOException
IOExceptionCopyright © 2010–2014 The Apache Software Foundation. All rights reserved.