|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.nutch.io.UTF8
A WritableComparable for strings that uses the UTF8 encoding.
Also includes utilities for efficiently reading and writing UTF-8.
Nested Class Summary | |
static class |
UTF8.Comparator
A WritableComparator optimized for UTF8 keys. |
Constructor Summary | |
UTF8()
|
|
UTF8(String string)
Construct from a given string. |
|
UTF8(UTF8 utf8)
Construct from a given string. |
Method Summary | |
int |
compareTo(Object o)
Compare two UTF8s. |
boolean |
equals(Object o)
Returns true iff o is a UTF8 with the same contents. |
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. |
void |
readFields(DataInput in)
Reads 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. |
void |
write(DataOutput out)
Writes the fields of this object to out . |
static int |
writeString(DataOutput out,
String s)
Write a UTF-8 encoded string. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, 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
IOException
public static void skip(DataInput in) throws IOException
IOException
public void write(DataOutput out) throws IOException
Writable
out
.
write
in interface Writable
IOException
public int compareTo(Object o)
compareTo
in interface Comparable
public String toString()
public boolean equals(Object o)
o
is a UTF8 with the same contents.
public static byte[] getBytes(String string)
String.getBytes(String)
public 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 |