Package org.apache.hadoop.hbase.util
Class Writables
java.lang.Object
org.apache.hadoop.hbase.util.Writables
Utility class with methods for manipulating Writable objects
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.io.Writable
copyWritable
(byte[] bytes, org.apache.hadoop.io.Writable tgt) Copy one Writable to another.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) Get the Writable's contents as a byte arraystatic byte[]
getBytes
(org.apache.hadoop.io.Writable... ws) Put a bunch of Writables as bytes all into the one byte array.static org.apache.hadoop.io.Writable
getWritable
(byte[] bytes, int offset, int length, org.apache.hadoop.io.Writable w) Set bytes into the passed Writable by calling itsWritable.readFields(java.io.DataInput)
.static org.apache.hadoop.io.Writable
getWritable
(byte[] bytes, org.apache.hadoop.io.Writable w) Set bytes into the passed Writable by calling itsWritable.readFields(java.io.DataInput)
.
-
Constructor Details
-
Writables
public Writables()
-
-
Method Details
-
getBytes
Get the Writable's contents as a byte array- Parameters:
w
- writable- Returns:
- The bytes of
w
gotten by running itsWritable.write(java.io.DataOutput)
method. - Throws:
IOException
- e- See Also:
-
getBytes
Put a bunch of Writables as bytes all into the one byte array.- Parameters:
ws
- writable- Returns:
- The bytes of
w
gotten by running itsWritable.write(java.io.DataOutput)
method. - Throws:
IOException
- e
-
getWritable
public static org.apache.hadoop.io.Writable getWritable(byte[] bytes, org.apache.hadoop.io.Writable w) throws IOException Set bytes into the passed Writable by calling itsWritable.readFields(java.io.DataInput)
.- Parameters:
bytes
- serialized bytesw
- An empty Writable (usually made by calling the null-arg constructor).- Returns:
- The passed Writable after its readFields has been called fed by the passed
bytes
array or IllegalArgumentException if passed null or an emptybytes
array. - Throws:
IOException
- e
-
getWritable
public static org.apache.hadoop.io.Writable getWritable(byte[] bytes, int offset, int length, org.apache.hadoop.io.Writable w) throws IOException Set bytes into the passed Writable by calling itsWritable.readFields(java.io.DataInput)
.- Parameters:
bytes
- serialized bytesoffset
- offset into arraylength
- length of dataw
- An empty Writable (usually made by calling the null-arg constructor).- Returns:
- The passed Writable after its readFields has been called fed by the passed
bytes
array or IllegalArgumentException if passed null or an emptybytes
array. - Throws:
IOException
- e
-
copyWritable
public static org.apache.hadoop.io.Writable copyWritable(org.apache.hadoop.io.Writable src, org.apache.hadoop.io.Writable tgt) throws IOException Copy one Writable to another. Copies bytes using data streams.- Parameters:
src
- Source Writabletgt
- Target Writable- Returns:
- The target Writable.
- Throws:
IOException
- e
-
copyWritable
public static org.apache.hadoop.io.Writable copyWritable(byte[] bytes, org.apache.hadoop.io.Writable tgt) throws IOException Copy one Writable to another. Copies bytes using data streams.- Parameters:
bytes
- Source Writabletgt
- Target Writable- Returns:
- The target Writable.
- Throws:
IOException
- e
-