|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nhncorp.neptune.common.io.NUTF8
public class NUTF8
A WritableComparable for strings that uses the UTF8 encoding.
Also includes utilities for efficiently reading and writing UTF-8.
| Nested Class Summary | |
|---|---|
static class |
NUTF8.Comparator
A WritableComparator optimized for UTF8 keys. |
| Constructor Summary | |
|---|---|
NUTF8()
|
|
NUTF8(NUTF8 utf8)
Construct from a given string. |
|
NUTF8(java.lang.String string)
Construct from a given string. |
|
| Method Summary | |
|---|---|
int |
compareTo(java.lang.Object o)
Compare two UTF8s. |
boolean |
equals(java.lang.Object o)
Returns true iff o is a UTF8 with the same contents. |
byte[] |
getBytes()
The raw bytes. |
static byte[] |
getBytes(java.lang.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(java.io.DataInput in)
Reads the fields of this object from in. |
static java.lang.String |
readString(java.io.DataInput in)
Read a UTF-8 encoded string. |
void |
set(NUTF8 other)
Set to contain the contents of a string. |
void |
set(java.lang.String string)
Set to contain the contents of a string. |
static void |
skip(java.io.DataInput in)
Skips over one UTF8 in the input. |
java.lang.String |
toString()
Convert to a String. |
void |
write(java.io.DataOutput out)
Writes the fields of this object to out. |
static int |
writeString(java.io.DataOutput out,
java.lang.String s)
Write a UTF-8 encoded string. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NUTF8()
public NUTF8(java.lang.String string)
public NUTF8(NUTF8 utf8)
| Method Detail |
|---|
public byte[] getBytes()
public int getLength()
public void set(java.lang.String string)
public void set(NUTF8 other)
public void readFields(java.io.DataInput in)
throws java.io.IOException
NWritablein. For efficiency,
implementations should attempt to re-use storage in the existing object
where possible.
readFields in interface NWritablejava.io.IOException
public static void skip(java.io.DataInput in)
throws java.io.IOException
java.io.IOException
public void write(java.io.DataOutput out)
throws java.io.IOException
NWritableout.
write in interface NWritablejava.io.IOExceptionpublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparablepublic java.lang.String toString()
toString in class java.lang.Objectpublic 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.getBytes(String)
public static java.lang.String readString(java.io.DataInput in)
throws java.io.IOException
java.io.IOExceptionDataInput.readUTF()
public static int writeString(java.io.DataOutput out,
java.lang.String s)
throws java.io.IOException
java.io.IOExceptionDataOutput.writeUTF(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||