String, instances are mutable. This is more
efficient than String when reading or writing a sequence of values,
as a single instance may be reused.
| Modifier and Type | Field and Description |
|---|---|
| private byte[] | |
| private static final byte[] | |
| private int | |
| private int | |
| private String |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public char | charAt(int
the index of the index)char value to be returnedImplements java. char value at the specified index.
|
| public int | compareTo(Utf8
the object to be compared. that)Implements java. |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public int | |
| public byte[] | |
| public static byte[] | |
| public int | |
| public int | |
| public int | |
| public void | readExternal(ObjectInput
the stream to read data from in order to restore the object in)Implements java. |
| public Utf8 | |
| public Utf8 | |
| public Utf8 | |
| public Utf8 | |
| public CharSequence | subSequence(int
the start index, inclusive start, int the end index, exclusive end)Implements java. CharSequence that is a subsequence of this sequence.
|
| public String | toString()
Overrides java. Implements java. |
| public void | writeExternal(ObjectOutput
the stream to write the object to out)Implements java. |
| bytes | back to summary |
|---|---|
| private byte[] bytes | |
| EMPTY | back to summary |
|---|---|
| private static final byte[] EMPTY | |
| hash | back to summary |
|---|---|
| private int hash | |
| length | back to summary |
|---|---|
| private int length | |
| string | back to summary |
|---|---|
| private String string | |
| Utf8 | back to summary |
|---|---|
| public Utf8() | |
| Utf8 | back to summary |
|---|---|
| public Utf8(String string) | |
| Utf8 | back to summary |
|---|---|
| public Utf8(Utf8 other) | |
| Utf8 | back to summary |
|---|---|
| public Utf8(byte[] bytes) | |
| charAt | back to summary |
|---|---|
| public char charAt(int index) Implements java. Doc from java. Returns the If the
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(Utf8 that) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getByteLength | back to summary |
|---|---|
| public int getByteLength() Return length in bytes. | |
| getBytes | back to summary |
|---|---|
| public byte[] getBytes() Return UTF-8 encoded bytes. Only valid through | |
| getBytesFor | back to summary |
|---|---|
| public static byte[] getBytesFor(String str) Gets the UTF-8 bytes for a String | |
| getLength | back to summary |
|---|---|
| public int getLength()
Deprecated call Return length in bytes.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| length | back to summary |
|---|---|
| public int length() Implements java. Doc from java. Returns the length of this character sequence. The length is the number
of 16-bit
| |
| readExternal | back to summary |
|---|---|
| public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException Implements java. Doc from java. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
| |
| set | back to summary |
|---|---|
| public Utf8 set(String string) Set to the contents of a String. | |
| set | back to summary |
|---|---|
| public Utf8 set(Utf8 other) | |
| setByteLength | back to summary |
|---|---|
| public Utf8 setByteLength(int newLength) Set length in bytes. Should called whenever byte content changes, even if the length does not change, as this also clears the cached String. | |
| setLength | back to summary |
|---|---|
| public Utf8 setLength(int newLength)
Deprecated call Set length in bytes. Should called whenever byte content changes, even if the length does not change, as this also clears the cached String.
| |
| subSequence | back to summary |
|---|---|
| public CharSequence subSequence(int start, int end) Implements java. Doc from java. Returns a
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Implements java. Doc from java. Returns a string containing the characters in this sequence in the same order as this sequence. The length of the string will be the length of this sequence. | |
| writeExternal | back to summary |
|---|---|
| public void writeExternal(ObjectOutput out) throws IOException Implements java. Doc from java. The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
| |