|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.io.Text
org.apache.hadoop.hbase.io.TextSequence
public class TextSequence
As CharSequence is to String, so is TextSequence to Text
(except a TextSequence is a Text whereas a String is a CharSequence). Use
when you want to conserve on object creation.
Use with care. If danger that the passed in Text instance can
change during the life of this TextSequence, concretize this TextSequence
by calling toText().
Equals considers a Text equal if the TextSequence brackets the same bytes.
TextSequence will not always work as a Text. For instance, the following
fails Text c = new Text(new TextSequence(new Text("some string")));
because the Text constructor accesses private Text data members
making the new instance from the passed 'Text'.
TODO: Should this be an Interface as CharSequence is?
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.hadoop.io.Text |
|---|
Text.Comparator |
| Constructor Summary | |
|---|---|
TextSequence()
|
|
TextSequence(Text d)
|
|
TextSequence(Text d,
int s)
|
|
TextSequence(Text d,
int s,
int e)
|
|
| Method Summary | |
|---|---|
int |
charAt(int position)
Returns the Unicode Scalar Value (32-bit integer value) for the character at position. |
int |
compareTo(Object o)
Compare two Texts bytewise using standard UTF8 ordering. |
boolean |
equals(Object o)
Returns true iff o is a Text with the same contents. |
int |
find(String what)
|
int |
find(String what,
int s)
Finds any occurence of what in the backing
buffer, starting as position start. |
byte[] |
getBytes()
Retuns the raw bytes. |
int |
getLength()
Returns the number of bytes in the byte array |
int |
hashCode()
hash function |
void |
readFields(DataInput in)
deserialize |
void |
set(byte[] utf8)
Set to a utf8 byte array |
void |
set(byte[] utf8,
int start,
int len)
Set the Text to range of bytes |
void |
set(String string)
Set to contain the contents of a string. |
void |
set(Text other)
copy a text. |
String |
toString()
Convert text back to string |
Text |
toText()
|
void |
write(DataOutput out)
serialize write this object to out length uses zero-compressed encoding |
| Methods inherited from class org.apache.hadoop.io.Text |
|---|
append, bytesToCodePoint, clear, decode, decode, decode, encode, encode, readString, skip, utf8Length, validateUTF8, validateUTF8, writeString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TextSequence()
public TextSequence(Text d)
public TextSequence(Text d,
int s)
public TextSequence(Text d,
int s,
int e)
| Method Detail |
|---|
public int charAt(int position)
Textposition. Note that this
method avoids using the converter or doing String instatiation
charAt in class Textpublic int compareTo(Object o)
Text
compareTo in interface ComparablecompareTo in class Textpublic boolean equals(Object o)
Texto is a Text with the same contents.
equals in class Text
public int find(String what,
int s)
Textwhat in the backing
buffer, starting as position start. The starting
position is measured in bytes and the return value is in
terms of byte position in the buffer. The backing buffer is
not converted to a string for this operation.
find in class Textpublic int find(String what)
find in class Textpublic byte[] getBytes()
Text
getBytes in class Textpublic Text toText()
public int getLength()
Text
getLength in class Textpublic int hashCode()
Text
hashCode in class Text
public void set(byte[] utf8,
int start,
int len)
Text
set in class Textutf8 - the data to copy fromstart - the first position of the new stringlen - the number of bytes of the new stringpublic void set(byte[] utf8)
Text
set in class Textpublic void set(String string)
Text
set in class Textpublic void set(Text other)
Text
set in class Textpublic String toString()
Text
toString in class TextObject.toString()
public void readFields(DataInput in)
throws IOException
Text
readFields in interface WritablereadFields in class Textin - DataInput to deseriablize this object from.
IOException
public void write(DataOutput out)
throws IOException
Text
write in interface Writablewrite in class Textout - DataOuput to serialize this object into.
IOExceptionWritable.write(DataOutput)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||