org.apache.hadoop.hbase.io
Class TextSequence
java.lang.Object
org.apache.hadoop.io.Text
org.apache.hadoop.hbase.io.TextSequence
- All Implemented Interfaces:
- Comparable, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable
public class TextSequence
- extends org.apache.hadoop.io.Text
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 classes/interfaces inherited from class org.apache.hadoop.io.Text |
org.apache.hadoop.io.Text.Comparator |
Methods inherited from class org.apache.hadoop.io.Text |
append, bytesToCodePoint, clear, decode, decode, decode, encode, encode, readString, skip, utf8Length, validateUTF8, validateUTF8, writeString |
TextSequence
public TextSequence()
TextSequence
public TextSequence(org.apache.hadoop.io.Text d)
TextSequence
public TextSequence(org.apache.hadoop.io.Text d,
int s)
TextSequence
public TextSequence(org.apache.hadoop.io.Text d,
int s,
int e)
charAt
public int charAt(int position)
- Overrides:
charAt
in class org.apache.hadoop.io.Text
compareTo
public int compareTo(Object o)
- Specified by:
compareTo
in interface Comparable
- Overrides:
compareTo
in class org.apache.hadoop.io.Text
equals
public boolean equals(Object o)
- Overrides:
equals
in class org.apache.hadoop.io.Text
find
public int find(String what,
int s)
- Overrides:
find
in class org.apache.hadoop.io.Text
find
public int find(String what)
- Overrides:
find
in class org.apache.hadoop.io.Text
getBytes
public byte[] getBytes()
- Overrides:
getBytes
in class org.apache.hadoop.io.Text
toText
public org.apache.hadoop.io.Text toText()
- Returns:
- A new Text instance made from the bytes this TextSequence covers.
getLength
public int getLength()
- Overrides:
getLength
in class org.apache.hadoop.io.Text
hashCode
public int hashCode()
- Overrides:
hashCode
in class org.apache.hadoop.io.Text
set
public void set(byte[] utf8,
int start,
int len)
- Overrides:
set
in class org.apache.hadoop.io.Text
set
public void set(byte[] utf8)
- Overrides:
set
in class org.apache.hadoop.io.Text
set
public void set(String string)
- Overrides:
set
in class org.apache.hadoop.io.Text
set
public void set(org.apache.hadoop.io.Text other)
- Overrides:
set
in class org.apache.hadoop.io.Text
toString
public String toString()
- Overrides:
toString
in class org.apache.hadoop.io.Text
readFields
public void readFields(DataInput in)
throws IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Overrides:
readFields
in class org.apache.hadoop.io.Text
- Throws:
IOException
write
public void write(DataOutput out)
throws IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Overrides:
write
in class org.apache.hadoop.io.Text
- Throws:
IOException
Copyright © 2008 The Apache Software Foundation