public class NumberField extends Field
| Modifier and Type | Field and Description |
|---|---|
static NumberField |
WORD_0
A four-byte field representing the number zero, used in many requests, so they can save the time and garbage
of constructing throwaway versions.
|
static NumberField |
WORD_1
A four-byte field representing the number one, used in some requests, so they can save the time and garbage
of constructing throwaway versions.
|
| Constructor and Description |
|---|
NumberField(byte typeTag,
DataInputStream is)
Constructor for reading from the network.
|
NumberField(long value)
Convenience constructor from code, for the most common case of wanting a 4-byte number field.
|
NumberField(long value,
int size)
Constructor from code.
|
| Modifier and Type | Method and Description |
|---|---|
byte |
getArgumentTag()
Get the value which identifies this type of field in a message argument list.
|
ByteBuffer |
getBytes()
Get the bytes which represent this field when sent over the network, including the leading type tag.
|
long |
getSize()
Get the size, in bytes, of the network representation of this field, excluding the leading type tag and
length bytes (if any).
|
byte |
getTypeTag()
Get the value which identifies the start of this field in the network stream.
|
long |
getValue()
Get the numeric value this field represents.
|
String |
toString() |
public static final NumberField WORD_0
public static final NumberField WORD_1
public NumberField(byte typeTag,
DataInputStream is)
throws IOException
typeTag - the tag which identified this field as a NumberField, and which allows us to determine the
proper size.is - the stream on which the field value is to be read.IllegalArgumentException - if tag is not a valid number field tag.IOException - if there is a problem reading the value.public NumberField(long value,
int size)
value - the desired value to be represented by this field.size - the number of bytes to be used to hold the value: 1, 2, or 4.IllegalArgumentException - if the specified size is not a supported number field size.public NumberField(long value)
value - the desired value to be represented by this field.public long getValue()
public byte getTypeTag()
FieldgetTypeTag in class Fieldpublic byte getArgumentTag()
FieldgetArgumentTag in class Fieldpublic long getSize()
Fieldpublic ByteBuffer getBytes()
FieldCopyright © 2016–2018 Deep Symmetry, LLC. All rights reserved.