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