public class WritableUtils extends Object
| Constructor and Description |
|---|
WritableUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends org.apache.hadoop.io.Writable> |
fromByteArray(byte[] array,
Class<T> clazz)
Read a writable from a byte array.
|
static String |
readStr(DataInput dataInput)
Read a string from a data input supporting
null values. |
static byte[] |
toByteArray(org.apache.hadoop.io.Writable writable)
Write a writable to a byte array.
|
static void |
writeStr(DataOutput dataOutput,
String str)
Write a string to a data output supporting
null values. |
public WritableUtils()
public static byte[] toByteArray(org.apache.hadoop.io.Writable writable)
writable - writable to write.public static <T extends org.apache.hadoop.io.Writable> T fromByteArray(byte[] array, Class<T> clazz)
array - byte array with the serialized writable.clazz - writable class.public static void writeStr(DataOutput dataOutput, String str) throws IOException
null values. It uses the '||' token to represent
null.dataOutput - data output.str - string to write.IOException - thrown if the string could not be written.public static String readStr(DataInput dataInput) throws IOException
null values. It uses the '||' token to represent
null.dataInput - data input.null if the '||' token was read.IOException - thrown if the string could not be read.Copyright © 2015 Apache Software Foundation. All Rights Reserved.