|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.util.Writables
public class Writables
Utility class with methods for manipulating Writable objects
Constructor Summary | |
---|---|
Writables()
|
Method Summary | |
---|---|
static long |
bytesToLong(byte[] bytes)
Converts a byte array to a long value |
static String |
bytesToString(byte[] bytes)
Converts a byte array to a string in a consistent manner. |
static org.apache.hadoop.io.Writable |
copyWritable(org.apache.hadoop.io.Writable src,
org.apache.hadoop.io.Writable tgt)
Copy one Writable to another. |
static byte[] |
getBytes(org.apache.hadoop.io.Writable w)
|
static HRegionInfo |
getHRegionInfo(byte[] bytes)
|
static HRegionInfo |
getHRegionInfoOrNull(byte[] bytes)
|
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) . |
static byte[] |
longToBytes(long val)
Convert a long value to a byte array |
static byte[] |
stringToBytes(String s)
Converts a string to a byte array in a consistent manner. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Writables()
Method Detail |
---|
public static byte[] getBytes(org.apache.hadoop.io.Writable w) throws IOException
w
-
w
gotten by running its
Writable.write(java.io.DataOutput)
method.
IOException
getWritable(byte[], Writable)
public static org.apache.hadoop.io.Writable getWritable(byte[] bytes, org.apache.hadoop.io.Writable w) throws IOException
Writable.readFields(java.io.DataInput)
.
bytes
- w
- An empty Writable (usually made by calling the null-arg
constructor).
bytes
array or IllegalArgumentException
if passed null or an empty bytes
array.
IOException
IllegalArgumentException
public static HRegionInfo getHRegionInfo(byte[] bytes) throws IOException
bytes
-
bytes
.
IOException
public static HRegionInfo getHRegionInfoOrNull(byte[] bytes) throws IOException
bytes
-
bytes
or null
if passed bytes are null or an empty array.
IOException
public static org.apache.hadoop.io.Writable copyWritable(org.apache.hadoop.io.Writable src, org.apache.hadoop.io.Writable tgt) throws IOException
src
- Source Writabletgt
- Target Writable
IOException
public static byte[] longToBytes(long val) throws IOException
val
-
IOException
public static long bytesToLong(byte[] bytes) throws IOException
bytes
-
IOException
public static byte[] stringToBytes(String s) throws UnsupportedEncodingException
s
-
UnsupportedEncodingException
public static String bytesToString(byte[] bytes) throws UnsupportedEncodingException
bytes
-
UnsupportedEncodingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |