java.lang.Comparable<UTF8>, Writable, WritableComparable<UTF8>@Deprecated
@LimitedPrivate({"HDFS","MapReduce"})
@Stable
public class UTF8
extends java.lang.Object
implements WritableComparable<UTF8>
Also includes utilities for efficiently reading and writing UTF-8. Note that this decodes UTF-8 but actually encodes CESU-8, a variant of UTF-8: see http://en.wikipedia.org/wiki/CESU-8
| Modifier and Type | Class | Description |
|---|---|---|
static class |
UTF8.Comparator |
Deprecated.
A WritableComparator optimized for UTF8 keys.
|
| Constructor | Description |
|---|---|
UTF8() |
Deprecated.
|
UTF8(java.lang.String string) |
Deprecated.
Construct from a given string.
|
UTF8(UTF8 utf8) |
Deprecated.
Construct from a given string.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
compareTo(UTF8 o) |
Deprecated.
Compare two UTF8s.
|
boolean |
equals(java.lang.Object o) |
Deprecated.
Returns true iff
o is a UTF8 with the same contents. |
static java.lang.String |
fromBytes(byte[] bytes) |
Deprecated.
|
byte[] |
getBytes() |
Deprecated.
|
static byte[] |
getBytes(java.lang.String string) |
Deprecated.
|
int |
getLength() |
Deprecated.
|
int |
hashCode() |
Deprecated.
|
void |
readFields(java.io.DataInput in) |
Deprecated.
Deserialize the fields of this object from
in. |
static java.lang.String |
readString(java.io.DataInput in) |
Deprecated.
|
void |
set(java.lang.String string) |
Deprecated.
Set to contain the contents of a string.
|
void |
set(UTF8 other) |
Deprecated.
Set to contain the contents of a string.
|
static void |
skip(java.io.DataInput in) |
Deprecated.
Skips over one UTF8 in the input.
|
java.lang.String |
toString() |
Deprecated.
Convert to a String.
|
java.lang.String |
toStringChecked() |
Deprecated.
Convert to a string, checking for valid UTF8.
|
void |
write(java.io.DataOutput out) |
Deprecated.
Serialize the fields of this object to
out. |
static int |
writeString(java.io.DataOutput out,
java.lang.String s) |
Deprecated.
|
public UTF8()
public UTF8(java.lang.String string)
string - input string.public UTF8(UTF8 utf8)
utf8 - input utf8.public byte[] getBytes()
public int getLength()
public void set(java.lang.String string)
string - input string.public void set(UTF8 other)
other - input other.public void readFields(java.io.DataInput in)
throws java.io.IOException
Writablein.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields in interface Writablein - DataInput to deseriablize this object from.java.io.IOException - any other problem for readFields.public static void skip(java.io.DataInput in)
throws java.io.IOException
in - datainput.java.io.IOException - raised on errors performing I/O.public void write(java.io.DataOutput out)
throws java.io.IOException
Writableout.public int compareTo(UTF8 o)
compareTo in interface java.lang.Comparable<UTF8>public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringChecked()
throws java.io.IOException
java.io.UTFDataFormatException - if the underlying bytes contain invalid
UTF8 data.java.io.IOExceptionpublic boolean equals(java.lang.Object o)
o is a UTF8 with the same contents.equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static byte[] getBytes(java.lang.String string)
string - input string.String.getBytes(String)public static java.lang.String fromBytes(byte[] bytes)
throws java.io.IOException
bytes - input bytes.java.io.IOException - if the byte array is invalid UTF8public static java.lang.String readString(java.io.DataInput in)
throws java.io.IOException
in - DataInput.java.io.IOException - raised on errors performing I/O.DataInput.readUTF()public static int writeString(java.io.DataOutput out,
java.lang.String s)
throws java.io.IOException
out - input out.s - input s.java.io.IOException - raised on errors performing I/O.DataOutput.writeUTF(String)Copyright © 2008–2025 Apache Software Foundation. All rights reserved.