|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.FudgeFieldType<byte[]>
org.fudgemsg.types.ByteArrayFieldType
public class ByteArrayFieldType
The type definition for a byte array.
Field Summary | |
---|---|
static ByteArrayFieldType |
LENGTH_128_INSTANCE
Standard Fudge field type: byte array of length 128. |
static ByteArrayFieldType |
LENGTH_16_INSTANCE
Standard Fudge field type: byte array of length 16. |
static ByteArrayFieldType |
LENGTH_20_INSTANCE
Standard Fudge field type: byte array of length 20. |
static ByteArrayFieldType |
LENGTH_256_INSTANCE
Standard Fudge field type: byte array of length 256. |
static ByteArrayFieldType |
LENGTH_32_INSTANCE
Standard Fudge field type: byte array of length 32. |
static ByteArrayFieldType |
LENGTH_4_INSTANCE
Standard Fudge field type: byte array of length 4. |
static ByteArrayFieldType |
LENGTH_512_INSTANCE
Standard Fudge field type: byte array of length 512. |
static ByteArrayFieldType |
LENGTH_64_INSTANCE
Standard Fudge field type: byte array of length 64. |
static ByteArrayFieldType |
LENGTH_8_INSTANCE
Standard Fudge field type: byte array of length 8. |
static ByteArrayFieldType |
VARIABLE_SIZED_INSTANCE
Standard Fudge field type: arbitrary length byte array. |
Method Summary | |
---|---|
static ByteArrayFieldType |
getBestMatch(byte[] array)
Reduces an arbitrary byte array to the most efficient type from the standard Fudge types. |
int |
getVariableSize(byte[] value,
FudgeTaxonomy taxonomy)
Gets the number of bytes used to encode a value. |
byte[] |
readValue(DataInput input,
int dataSize)
Reads a value of this type to the output. |
void |
writeValue(DataOutput output,
byte[] value)
Writes a value of this type to the output. |
Methods inherited from class org.fudgemsg.FudgeFieldType |
---|
equals, getFixedSize, getJavaType, getTypeId, hashCode, isVariableSize, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ByteArrayFieldType VARIABLE_SIZED_INSTANCE
FudgeTypeDictionary.BYTE_ARRAY_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_4_INSTANCE
FudgeTypeDictionary.BYTE_ARR_4_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_8_INSTANCE
FudgeTypeDictionary.BYTE_ARR_8_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_16_INSTANCE
FudgeTypeDictionary.BYTE_ARR_16_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_20_INSTANCE
FudgeTypeDictionary.BYTE_ARR_20_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_32_INSTANCE
FudgeTypeDictionary.BYTE_ARR_32_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_64_INSTANCE
FudgeTypeDictionary.BYTE_ARR_64_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_128_INSTANCE
FudgeTypeDictionary.BYTE_ARR_128_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_256_INSTANCE
FudgeTypeDictionary.BYTE_ARR_256_TYPE_ID
.
public static final ByteArrayFieldType LENGTH_512_INSTANCE
FudgeTypeDictionary.BYTE_ARR_512_TYPE_ID
.
Method Detail |
---|
public static ByteArrayFieldType getBestMatch(byte[] array)
array
- the array
ByteArrayFieldType
availablepublic int getVariableSize(byte[] value, FudgeTaxonomy taxonomy)
A variable width type must override this method.
A fixed width type will return the fixed size
.
getVariableSize
in class FudgeFieldType<byte[]>
value
- the value to check, not used for fixed width typestaxonomy
- the taxonomy being used for the encoding, not used for fixed width types
public byte[] readValue(DataInput input, int dataSize) throws IOException
This is intended for use by variable width types and must read the given value. The implementation must read exactly the number of bytes passed into the method.
readValue
in class FudgeFieldType<byte[]>
input
- the input source to read the value from, not nulldataSize
- the number of bytes of data to read
IOException
- if an error occurs, which must be wrapped by the callerpublic void writeValue(DataOutput output, byte[] value) throws IOException
This is intended for use by variable width types and must write the given value.
The implementation must write exactly the number of bytes returned by the
size calculation
.
writeValue
in class FudgeFieldType<byte[]>
output
- the output target to write the value to, not nullvalue
- the value to write
IOException
- if an error occurs, which must be wrapped by the caller
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |