|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.accumulo.core.data.Value
public class Value
A byte sequence that is usable as a key or value. Based on 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 its comparatively
'immutable'.
Nested Class Summary | |
---|---|
static class |
Value.Comparator
A Comparator optimized for Value. |
Field Summary | |
---|---|
protected byte[] |
value
|
Constructor Summary | |
---|---|
Value()
Create a zero-size sequence. |
|
Value(byte[] bytes)
Create a Value using the byte array as the initial value. |
|
Value(byte[] bytes,
boolean copy)
|
|
Value(byte[] newData,
int offset,
int length)
Set the value to a copy of the given byte range |
|
Value(Value ibw)
Set the new Value to a copy of the contents of the passed ibw . |
Method Summary | |
---|---|
static long |
bytesToLong(byte[] bytes)
Converts a byte array to a long value |
static java.lang.String |
bytesToString(byte[] bytes)
Converts a byte array to a string in a consistent manner. |
int |
compareTo(byte[] that)
Compares the bytes in this object to the specified byte array |
int |
compareTo(java.lang.Object right_obj)
Define the sort order of the BytesWritable. |
void |
copy(byte[] b)
|
boolean |
equals(java.lang.Object right_obj)
|
byte[] |
get()
Get the data from the BytesWritable. |
static byte[] |
getBytes(org.apache.hadoop.io.Writable w)
|
int |
getSize()
|
static org.apache.hadoop.io.Writable |
getWritable(byte[] bytes,
org.apache.hadoop.io.Writable w)
Set bytes into the passed Writable by calling its Writable.readFields(java.io.DataInput) . |
int |
hashCode()
|
static byte[] |
longToBytes(long val)
Convert a long value to a byte array |
void |
readFields(java.io.DataInput in)
|
void |
set(byte[] b)
|
static byte[] |
stringToBytes(java.lang.String s)
Converts a string to a byte array in a consistent manner. |
static byte[][] |
toArray(java.util.List<byte[]> array)
|
java.lang.String |
toString()
|
void |
write(java.io.DataOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected byte[] value
Constructor Detail |
---|
public Value()
public Value(byte[] bytes)
bytes
- This array becomes the backing storage for the object.public Value(byte[] bytes, boolean copy)
public Value(Value ibw)
ibw
.
ibw
- the value to set this Value to.public Value(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 copyMethod Detail |
---|
public byte[] get()
public void set(byte[] b)
b
- Use passed bytes as backing array for this instance.public void copy(byte[] b)
b
- copy bytespublic int getSize()
public void readFields(java.io.DataInput in) throws java.io.IOException
readFields
in interface org.apache.hadoop.io.Writable
java.io.IOException
public void write(java.io.DataOutput out) throws java.io.IOException
write
in interface org.apache.hadoop.io.Writable
java.io.IOException
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object right_obj)
compareTo
in interface java.lang.Comparable<java.lang.Object>
right_obj
- The other bytes writable
public int compareTo(byte[] that)
public boolean equals(java.lang.Object right_obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static byte[][] toArray(java.util.List<byte[]> array)
public static byte[] longToBytes(long val) throws java.io.IOException
java.io.IOException
public static long bytesToLong(byte[] bytes) throws java.io.IOException
java.io.IOException
public static byte[] stringToBytes(java.lang.String s) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static java.lang.String bytesToString(byte[] bytes) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static byte[] getBytes(org.apache.hadoop.io.Writable w) throws java.io.IOException
w
gotten by running its Writable.write(java.io.DataOutput)
method.
java.io.IOException
getWritable(byte[], Writable)
public static org.apache.hadoop.io.Writable getWritable(byte[] bytes, org.apache.hadoop.io.Writable w) throws java.io.IOException
Writable.readFields(java.io.DataInput)
.
w
- An empty Writable (usually made by calling the null-arg constructor).
bytes
array or IllegalArgumentException if passed null or
an empty bytes
array.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |