|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.io.UTF8
@Deprecated @InterfaceAudience.LimitedPrivate(value={"HDFS","MapReduce"}) @InterfaceStability.Stable public class UTF8
A WritableComparable for strings that uses the UTF8 encoding.
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
Nested Class Summary | |
---|---|
static class |
UTF8.Comparator
Deprecated. A WritableComparator optimized for UTF8 keys. |
Constructor Summary | |
---|---|
UTF8()
Deprecated. |
|
UTF8(String string)
Deprecated. Construct from a given string. |
|
UTF8(UTF8 utf8)
Deprecated. Construct from a given string. |
Method Summary | |
---|---|
int |
compareTo(UTF8 o)
Deprecated. Compare two UTF8s. |
boolean |
equals(Object o)
Deprecated. Returns true iff o is a UTF8 with the same contents. |
static String |
fromBytes(byte[] bytes)
Deprecated. Convert a UTF-8 encoded byte array back into a string. |
byte[] |
getBytes()
Deprecated. The raw bytes. |
static byte[] |
getBytes(String string)
Deprecated. Convert a string to a UTF-8 encoded byte array. |
int |
getLength()
Deprecated. The number of bytes in the encoded string. |
int |
hashCode()
Deprecated. |
void |
readFields(DataInput in)
Deprecated. Deserialize the fields of this object from in . |
static String |
readString(DataInput in)
Deprecated. Read a UTF-8 encoded string. |
void |
set(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(DataInput in)
Deprecated. Skips over one UTF8 in the input. |
String |
toString()
Deprecated. Convert to a String. |
String |
toStringChecked()
Deprecated. Convert to a string, checking for valid UTF8. |
void |
write(DataOutput out)
Deprecated. Serialize the fields of this object to out . |
static int |
writeString(DataOutput out,
String s)
Deprecated. Write a UTF-8 encoded string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UTF8()
public UTF8(String string)
public UTF8(UTF8 utf8)
Method Detail |
---|
public byte[] getBytes()
public int getLength()
public void set(String string)
public void set(UTF8 other)
public void readFields(DataInput in) throws IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
in
- DataInput
to deseriablize this object from.
IOException
public static void skip(DataInput in) throws IOException
IOException
public void write(DataOutput out) throws IOException
Writable
out
.
write
in interface Writable
out
- DataOuput
to serialize this object into.
IOException
public int compareTo(UTF8 o)
compareTo
in interface Comparable<UTF8>
public String toString()
toString
in class Object
public String toStringChecked() throws IOException
UTFDataFormatException
- if the underlying bytes contain invalid
UTF8 data.
IOException
public boolean equals(Object o)
o
is a UTF8 with the same contents.
equals
in class Object
public int hashCode()
hashCode
in class Object
public static byte[] getBytes(String string)
String.getBytes(String)
public static String fromBytes(byte[] bytes) throws IOException
IOException
- if the byte array is invalid UTF8public static String readString(DataInput in) throws IOException
IOException
DataInput.readUTF()
public static int writeString(DataOutput out, String s) throws IOException
IOException
DataOutput.writeUTF(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |