@Deprecated @InterfaceAudience.LimitedPrivate(value={"HDFS","MapReduce"}) @InterfaceStability.Stable public class UTF8 extends 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
限定符和类型 | 类和说明 |
---|---|
static class |
UTF8.Comparator
已过时。
A WritableComparator optimized for UTF8 keys.
|
构造器和说明 |
---|
UTF8()
已过时。
|
UTF8(String string)
已过时。
Construct from a given string.
|
UTF8(UTF8 utf8)
已过时。
Construct from a given string.
|
限定符和类型 | 方法和说明 |
---|---|
int |
compareTo(UTF8 o)
已过时。
Compare two UTF8s.
|
boolean |
equals(Object o)
已过时。
Returns true iff
o is a UTF8 with the same contents. |
static String |
fromBytes(byte[] bytes)
已过时。
Convert a UTF-8 encoded byte array back into a string.
|
byte[] |
getBytes()
已过时。
The raw bytes.
|
static byte[] |
getBytes(String string)
已过时。
Convert a string to a UTF-8 encoded byte array.
|
int |
getLength()
已过时。
The number of bytes in the encoded string.
|
int |
hashCode()
已过时。
|
void |
readFields(DataInput in)
已过时。
Deserialize the fields of this object from
in . |
static String |
readString(DataInput in)
已过时。
Read a UTF-8 encoded string.
|
void |
set(String string)
已过时。
Set to contain the contents of a string.
|
void |
set(UTF8 other)
已过时。
Set to contain the contents of a string.
|
static void |
skip(DataInput in)
已过时。
Skips over one UTF8 in the input.
|
String |
toString()
已过时。
Convert to a String.
|
String |
toStringChecked()
已过时。
Convert to a string, checking for valid UTF8.
|
void |
write(DataOutput out)
已过时。
Serialize the fields of this object to
out . |
static int |
writeString(DataOutput out,
String s)
已过时。
Write a UTF-8 encoded string.
|
public UTF8()
public UTF8(String string)
public UTF8(UTF8 utf8)
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
在接口中 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
在接口中 Writable
out
- DataOuput
to serialize this object into.IOException
public int compareTo(UTF8 o)
compareTo
在接口中 Comparable<UTF8>
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.public static byte[] getBytes(String 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
Copyright © 2009 The Apache Software Foundation