|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.io.BytesWritable
A byte sequence that is usable as a key or value. It is resizable and distinguishes between the size of the seqeunce and the current capacity. The hash function is the front of the md5 of the buffer. The sort order is the same as memcmp.
Nested Class Summary | |
static class |
BytesWritable.Comparator
A Comparator optimized for BytesWritable. |
Constructor Summary | |
BytesWritable()
Create a zero-size sequence. |
|
BytesWritable(byte[] bytes)
Create a BytesWritable using the byte array as the initial value. |
Method Summary | |
int |
compareTo(Object right_obj)
Define the sort order of the BytesWritable. |
boolean |
equals(Object right_obj)
Are the two byte sequences equal? |
byte[] |
get()
Get the data from the BytesWritable. |
int |
getCapacity()
Get the capacity, which is the maximum size that could handled without resizing the backing storage. |
int |
getSize()
Get the current size of the buffer. |
int |
hashCode()
|
void |
readFields(DataInput in)
Reads the fields of this object from in . |
void |
setCapacity(int new_cap)
Change the capacity of the backing storage. |
void |
setSize(int size)
Change the size of the buffer. |
void |
write(DataOutput out)
Writes the fields of this object to out . |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BytesWritable()
public BytesWritable(byte[] bytes)
bytes
- This array becomes the backing storage for the object.Method Detail |
public byte[] get()
public int getSize()
public void setSize(int size)
size
- The new number of bytespublic int getCapacity()
public void setCapacity(int new_cap)
new_cap
- The new capacity in bytes.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 void write(DataOutput out) throws IOException
Writable
out
.
write
in interface Writable
IOException
public int hashCode()
public int compareTo(Object right_obj)
compareTo
in interface Comparable
right_obj
- The other bytes writable
public boolean equals(Object right_obj)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |