public class Field
extends java.lang.Object
Message
.
Implemented with byte array and int offset and length primitives to maximize
heap efficiency of cloning, reads, updates, and comparisons.Constructor and Description |
---|
Field()
Default constructor.
|
Field(byte[] buffer,
int position,
int length)
Constructs an instance with the specified region of a byte buffer.
|
Field(java.lang.String value)
Constructs an instance with the bytes of the specified string value.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteAt(int i)
Returns the byte at
position plus index i. |
Field |
copy()
Constructs a new Field and sets its value to a deep copy of this instance.
|
void |
copyFrom(Field f)
Sets the value of this instance to a deep copy of the value
of the specified field.
|
boolean |
equals(java.lang.Object obj)
Default implementation for
Object.equals(java.lang.Object) for a Field. |
int |
hashCode()
Default implementation of
Object.hashCode() for a Field. |
boolean |
isNull()
Indicates whether this instance's value is null.
|
void |
reset()
Resets the value of this instance to null.
|
void |
set(byte[] buffer)
Sets the value of this instance with the specified buffer.
|
void |
set(byte[] buffer,
int position,
int length)
Sets the value of this instance with the specified region of a byte buffer.
|
java.lang.String |
toString()
Converts the value to a string representation where each byte is interpreted as a Java character.
|
public Field()
public Field(java.lang.String value)
value
- The string to be converted into UTF-8 bytes.public Field(byte[] buffer, int position, int length)
buffer
- The byte buffer.position
- 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 final void set(byte[] buffer, int position, int length)
buffer
- The byte buffer.position
- 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 set(byte[] buffer)
buffer
- The byte buffer to be copied.public boolean isNull()
public void reset()
public byte byteAt(int i)
position
plus index i.i
- The given index.public int hashCode()
Object.hashCode()
for a Field.hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
Object.equals(java.lang.Object)
for a Field. For two
Fields to be considered equal, their values must have the same length
and all bytes in the value must be equal.equals
in class java.lang.Object
obj
- The object to compare this with.public Field copy()
public java.lang.String toString()
toString
in class java.lang.Object
public void copyFrom(Field f)
f
- The Field to copy from.