Class StringField
- java.lang.Object
-
- org.deepsymmetry.beatlink.dbserver.Field
-
- org.deepsymmetry.beatlink.dbserver.StringField
-
public class StringField extends Field
A string field holds a UTF8-BE encoded string whose length is determined by the 4-byte big-endian integer that follows the type tag.- Author:
- James Elliott
-
-
Constructor Summary
Constructors Constructor Description StringField(DataInputStream is)Constructor for reading from the network.StringField(String text)Constructor for code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description bytegetArgumentTag()Get the value which identifies this type of field in a message argument list.ByteBuffergetBytes()Get the bytes which represent this field when sent over the network, including the leading type tag.longgetSize()Get the size, in bytes, of the network representation of this field, excluding the leading type tag and length bytes (if any).bytegetTypeTag()Get the value which identifies the start of this field in the network stream.StringgetValue()Get the string represented by this field.StringtoString()
-
-
-
Constructor Detail
-
StringField
public StringField(DataInputStream is) throws IOException
Constructor for reading from the network.- Parameters:
is- the stream on which the field value is to be read.- Throws:
IOException- if there is a problem reading the value.
-
StringField
public StringField(String text)
Constructor for code.- Parameters:
text- the value that this field will convey.
-
-
Method Detail
-
getValue
public String getValue()
Get the string represented by this field.- Returns:
- the text that this field contains.
-
getTypeTag
public byte getTypeTag()
Description copied from class:FieldGet the value which identifies the start of this field in the network stream.- Specified by:
getTypeTagin classField- Returns:
- the tag which tells the recipient that this particular type of field is coming.
-
getArgumentTag
public byte getArgumentTag()
Description copied from class:FieldGet the value which identifies this type of field in a message argument list.- Specified by:
getArgumentTagin classField- Returns:
- the tag which is used instead of the type tag for some reason when putting together the argument type list for a dbserver message.
-
getBytes
public ByteBuffer getBytes()
Description copied from class:FieldGet the bytes which represent this field when sent over the network, including the leading type tag.
-
getSize
public long getSize()
Description copied from class:FieldGet the size, in bytes, of the network representation of this field, excluding the leading type tag and length bytes (if any).
-
-