public class StringField extends Field
Message
which consists of
a string.Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
LATIN1 |
protected static byte |
LATIN1_ZERO |
Modifier | Constructor and Description |
---|---|
|
StringField()
Default constructor.
|
protected |
StringField(byte[] buffer,
int position,
int length)
Initializes a new instance of the StringField class with the
specified buffer, position, and length.
|
|
StringField(java.lang.String value)
Initializes a new instance of the StringField class with the specified
string value.
|
Modifier and Type | Method and Description |
---|---|
protected int |
getConversionBufInitialSize()
Returns the initial default size for the byte and char conversion buffers
used by this instance.
|
boolean |
getValue(java.nio.ByteBuffer v)
Writes the byte value of this instance into the specified byte buffer, if the
value is not null.
|
java.lang.String |
getValue(java.nio.charset.CharsetDecoder decoder)
Returns a string representation of the Field value, where the bytes are interpreted by using the specified
decoder.
|
boolean |
getValue(CommandId v)
Writes the byte value of this instance into the specified command ID buffer
object, if the value is not null.
|
void |
setValue(byte[] v,
int offset,
int length)
Sets the value of this instance with the specified region of a byte buffer.
|
void |
setValue(CommandId v)
Sets the value of this instance with the specified buffer from the command ID object.
|
void |
setValue(java.lang.String v,
java.nio.charset.CharsetEncoder encoder)
Sets the value of this instance from the specified string.
|
protected static final java.lang.String LATIN1
protected static final byte LATIN1_ZERO
protected StringField(byte[] buffer, int position, int length)
buffer
- The byte array buffer containing the string
data.position
- The starting position of the string within
the buffer.length
- The length of the string.public StringField()
public StringField(java.lang.String value)
value
- The string value to initialize the StringField with.protected int getConversionBufInitialSize()
public java.lang.String getValue(java.nio.charset.CharsetDecoder decoder)
decoder
- The charset decoder used to interpret bytes as characters.public boolean getValue(java.nio.ByteBuffer v)
v
- The byte buffer to write in to.public boolean getValue(CommandId v)
v
- The command ID object to write in to.public void setValue(byte[] v, int offset, int length)
v
- The byte buffer.offset
- The starting position of the value in the byte buffer.length
- The length from the starting position of the value in the byte
buffer.public void setValue(CommandId v)
v
- The command ID object whose value is used to set this instance.public void setValue(java.lang.String v, java.nio.charset.CharsetEncoder encoder)
v
- The string used as the value.encoder
- The encoder used to interpret the string's characters as
bytes.