public class BytesWritable extends BinaryComparable implements WritableComparable<BinaryComparable>
| 限定符和类型 | 类和说明 |
|---|---|
static class |
BytesWritable.Comparator
A Comparator optimized for BytesWritable.
|
| 构造器和说明 |
|---|
BytesWritable()
Create a zero-size sequence.
|
BytesWritable(byte[] bytes)
Create a BytesWritable using the byte array as the initial value.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object right_obj)
Are the two byte sequences equal?
|
byte[] |
get()
已过时。
Use
getBytes() instead. |
byte[] |
getBytes()
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 |
getLength()
Get the current size of the buffer.
|
int |
getSize()
已过时。
Use
getLength() instead. |
int |
hashCode()
Return a hash of the bytes returned from {#getBytes()}.
|
void |
readFields(DataInput in)
Deserialize the fields of this object from
in. |
void |
set(byte[] newData,
int offset,
int length)
Set the value to a copy of the given byte range
|
void |
set(BytesWritable newData)
Set the BytesWritable to the contents of the given newData.
|
void |
setCapacity(int new_cap)
Change the capacity of the backing storage.
|
void |
setSize(int size)
Change the size of the buffer.
|
String |
toString()
Generate the stream of bytes as hex pairs separated by ' '.
|
void |
write(DataOutput out)
Serialize the fields of this object to
out. |
compareTo, compareTocompareTopublic BytesWritable()
public BytesWritable(byte[] bytes)
bytes - This array becomes the backing storage for the object.public byte[] getBytes()
getBytes 在类中 BinaryComparable@Deprecated public byte[] get()
getBytes() instead.public int getLength()
getLength 在类中 BinaryComparable@Deprecated public int getSize()
getLength() instead.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 set(BytesWritable newData)
newData - the value to set this BytesWritable to.public void set(byte[] newData,
int offset,
int length)
newData - the new values to copy inoffset - the offset in newData to start atlength - the number of bytes to copypublic void readFields(DataInput in) throws IOException
Writablein.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields 在接口中 Writablein - DataInput to deseriablize this object from.IOExceptionpublic void write(DataOutput out) throws IOException
Writableout.write 在接口中 Writableout - DataOuput to serialize this object into.IOExceptionpublic int hashCode()
BinaryComparablepublic boolean equals(Object right_obj)
equals 在类中 BinaryComparableCopyright © 2009 The Apache Software Foundation