|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.util.Bytes
public class Bytes
Utility class that handles byte arrays, conversions to/from other types, comparisons, hash code generation, manufacturing keys for HashMaps or HashSets, etc.
| Field Summary | |
|---|---|
static Comparator<byte[]> |
BYTES_COMPARATOR
Pass this to TreeMaps where byte [] are keys. |
static int |
SIZEOF_INT
Size of int in bytes |
static int |
SIZEOF_LONG
Size of long in bytes |
| Constructor Summary | |
|---|---|
Bytes()
|
|
| Method Summary | |
|---|---|
static byte[] |
add(byte[] a,
byte[] b)
|
static byte[] |
add(byte[] a,
byte[] b,
byte[] c)
|
static int |
compareTo(byte[] left,
byte[] right)
|
static int |
compareTo(byte[] left,
int leftOffset,
int leftLength,
byte[] right,
int rightOffset,
int rightLength)
|
static boolean |
equals(byte[] left,
byte[] right)
|
static int |
hashCode(byte[] b)
|
static int |
hashCode(byte[] b,
int length)
|
static Integer |
mapKey(byte[] b)
|
static Integer |
mapKey(byte[] b,
int length)
|
static byte[] |
readByteArray(DataInput in)
|
static byte[][] |
toByteArrays(byte[] column)
|
static byte[][] |
toByteArrays(String column)
|
static byte[][] |
toByteArrays(String[] t)
|
static byte[] |
toBytes(int val)
Convert an int value to a byte array |
static byte[] |
toBytes(long val)
Convert a long value to a byte array |
static byte[] |
toBytes(String s)
Converts a string to a UTF-8 byte array. |
static int |
toInt(byte[] bytes)
Converts a byte array to a long value |
static long |
toLong(byte[] bytes)
Converts a byte array to a long value |
static String |
toString(byte[] b)
|
static void |
writeByteArray(DataOutput out,
byte[] b)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SIZEOF_LONG
public static final int SIZEOF_INT
public static Comparator<byte[]> BYTES_COMPARATOR
| Constructor Detail |
|---|
public Bytes()
| Method Detail |
|---|
public static byte[] readByteArray(DataInput in)
throws IOException
in - Input to read from.
in
IOException
public static void writeByteArray(DataOutput out,
byte[] b)
throws IOException
out - b -
IOExceptionpublic static String toString(byte[] b)
b - Presumed UTF-8 encoded byte array.
bpublic static byte[] toBytes(String s)
s -
public static byte[] toBytes(long val)
val -
public static long toLong(byte[] bytes)
bytes -
public static byte[] toBytes(int val)
val -
public static int toInt(byte[] bytes)
bytes -
public static int compareTo(byte[] left,
byte[] right)
left - right -
public static int compareTo(byte[] left,
int leftOffset,
int leftLength,
byte[] right,
int rightOffset,
int rightLength)
left - right - leftOffset - Where to start comparing in the left bufferrightOffset - Where to start comparing in the right bufferleftLength - How much to compare from the left bufferrightLength - How much to compare from the right buffer
public static boolean equals(byte[] left,
byte[] right)
left - right -
public static int hashCode(byte[] b)
b -
WritableComparator.hashBytes(byte[], int) on the
passed in array. This method is what Text and
ImmutableBytesWritable use calculating hash code.
public static int hashCode(byte[] b,
int length)
b - length -
WritableComparator.hashBytes(byte[], int) on the
passed in array. This method is what Text and
ImmutableBytesWritable use calculating hash code.public static Integer mapKey(byte[] b)
b -
b as an Integer that can be used as key in
Maps.
public static Integer mapKey(byte[] b,
int length)
b - length -
b as an Integer that can be used as key in
Maps.
public static byte[] add(byte[] a,
byte[] b)
a - b -
public static byte[] add(byte[] a,
byte[] b,
byte[] c)
a - b - c -
public static byte[][] toByteArrays(String[] t)
t -
public static byte[][] toByteArrays(String column)
column -
columnpublic static byte[][] toByteArrays(byte[] column)
column -
column
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||