Package org.apache.hadoop.io
Class UTF8
java.lang.Object
org.apache.hadoop.io.UTF8
- All Implemented Interfaces:
Comparable<UTF8>,Writable,WritableComparable<UTF8>
@Deprecated
@LimitedPrivate({"HDFS","MapReduce"})
@Stable
public class UTF8
extends Object
implements WritableComparable<UTF8>
Deprecated.
replaced by Text
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
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.A WritableComparator optimized for UTF8 keys. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintDeprecated.Compare two UTF8s.booleanDeprecated.Returns true iffois a UTF8 with the same contents.static StringfromBytes(byte[] bytes) Deprecated.byte[]getBytes()Deprecated.static byte[]Deprecated.intDeprecated.inthashCode()Deprecated.voidreadFields(DataInput in) Deprecated.Deserialize the fields of this object fromin.static StringreadString(DataInput in) Deprecated.voidDeprecated.Set to contain the contents of a string.voidDeprecated.Set to contain the contents of a string.static voidDeprecated.Skips over one UTF8 in the input.toString()Deprecated.Convert to a String.Deprecated.Convert to a string, checking for valid UTF8.voidwrite(DataOutput out) Deprecated.Serialize the fields of this object toout.static intwriteString(DataOutput out, String s) Deprecated.
-
Constructor Details
-
UTF8
public UTF8()Deprecated. -
UTF8
Deprecated.Construct from a given string.- Parameters:
string- input string.
-
UTF8
Deprecated.Construct from a given string.- Parameters:
utf8- input utf8.
-
-
Method Details
-
getBytes
public byte[] getBytes()Deprecated.- Returns:
- The raw bytes.
-
getLength
public int getLength()Deprecated.- Returns:
- The number of bytes in the encoded string.
-
set
Deprecated.Set to contain the contents of a string.- Parameters:
string- input string.
-
set
Deprecated.Set to contain the contents of a string.- Parameters:
other- input other.
-
readFields
Deprecated.Description copied from interface:WritableDeserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-
skip
Deprecated.Skips over one UTF8 in the input.- Parameters:
in- datainput.- Throws:
IOException- raised on errors performing I/O.
-
write
Deprecated.Description copied from interface:WritableSerialize the fields of this object toout.- Specified by:
writein interfaceWritable- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException- any other problem for write.
-
compareTo
Deprecated.Compare two UTF8s.- Specified by:
compareToin interfaceComparable<UTF8>
-
toString
Deprecated.Convert to a String. -
toStringChecked
Deprecated.Convert to a string, checking for valid UTF8.- Returns:
- the converted string
- Throws:
UTFDataFormatException- if the underlying bytes contain invalid UTF8 data.IOException
-
equals
Deprecated.Returns true iffois a UTF8 with the same contents. -
hashCode
public int hashCode()Deprecated. -
getBytes
Deprecated.- Parameters:
string- input string.- Returns:
- Convert a string to a UTF-8 encoded byte array.
- See Also:
-
fromBytes
Deprecated.- Parameters:
bytes- input bytes.- Returns:
- Convert a UTF-8 encoded byte array back into a string.
- Throws:
IOException- if the byte array is invalid UTF8
-
readString
Deprecated.- Parameters:
in- DataInput.- Returns:
- Read a UTF-8 encoded string.
- Throws:
IOException- raised on errors performing I/O.- See Also:
-
writeString
Deprecated.- Parameters:
out- input out.s- input s.- Returns:
- Write a UTF-8 encoded string.
- Throws:
IOException- raised on errors performing I/O.- See Also:
-