public class Value extends Object implements org.apache.hadoop.io.WritableComparable<Object>
BytesWritable
only this class is NOT resizable and DOES NOT
distinguish between the size of the sequence and the current capacity as BytesWritable
does. Hence it is comparatively
'immutable'.Modifier and Type | Class and Description |
---|---|
static class |
Value.Comparator
A Comparator optimized for Value.
|
Modifier and Type | Field and Description |
---|---|
protected byte[] |
value |
Constructor and Description |
---|
Value()
Creates a zero-size sequence.
|
Value(byte[] bytes)
Creates a Value using a byte array as the initial value.
|
Value(byte[] bytes,
boolean copy)
Creates a Value using a byte array as the initial value.
|
Value(byte[] newData,
int offset,
int length)
Creates a Value based on a range in a byte array.
|
Value(ByteBuffer bytes)
Creates a Value using the bytes in a buffer as the initial value.
|
Value(ByteBuffer bytes,
boolean copy)
Deprecated.
A copy of the bytes in the buffer is always made. Use
Value(ByteBuffer) instead. |
Value(CharSequence cs)
Creates a value using the UTF-8 encoding of the CharSequence
|
Value(org.apache.hadoop.io.Text text)
Creates a Value using the bytes of the Text.
|
Value(Value ibw)
Creates a new Value based on another.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(byte[] that)
Compares the bytes in this object to the specified byte array
|
int |
compareTo(Object right_obj)
Define the sort order of the BytesWritable.
|
void |
copy(byte[] b)
Sets the byte data of this value.
|
boolean |
equals(Object right_obj) |
byte[] |
get()
Gets the byte data of this value.
|
int |
getSize()
Gets the size of this value.
|
int |
hashCode() |
void |
readFields(DataInput in) |
void |
set(byte[] b)
Sets the byte data of this value.
|
static byte[][] |
toArray(List<byte[]> array)
Deprecated.
since 1.7.0; this utility method is not appropriate for the
Value object |
String |
toString() |
void |
write(DataOutput out) |
public Value()
public Value(CharSequence cs)
cs
- may not be nullpublic Value(org.apache.hadoop.io.Text text)
text
- may not be nullpublic Value(byte[] bytes)
bytes
- May not be nullpublic Value(ByteBuffer bytes)
bytes
- May not be null@Deprecated public Value(ByteBuffer bytes, boolean copy)
Value(ByteBuffer)
instead.bytes
- bytes of value (may not be null)copy
- false to use the backing array of the buffer directly as the backing array, true to force a copypublic Value(byte[] bytes, boolean copy)
bytes
- may not be nullcopy
- false to use the given byte array directly as the backing array, true to force a copypublic Value(Value ibw)
ibw
- may not be null.public Value(byte[] newData, int offset, int length)
newData
- source of copy, may not be nulloffset
- the offset in newData to start with for valye byteslength
- the number of bytes in the valueIndexOutOfBoundsException
- if offset or length are invalidpublic byte[] get()
public void set(byte[] b)
b
- may not be nullpublic void copy(byte[] b)
b
- may not be nullpublic int getSize()
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public int compareTo(Object right_obj)
compareTo
in interface Comparable<Object>
right_obj
- The other bytes writablepublic int compareTo(byte[] that)
@Deprecated public static byte[][] toArray(List<byte[]> array)
Value
objectarray
- list of byte arraysCopyright © 2011–2017 The Apache Software Foundation. All rights reserved.