public class IOUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
Constructor and Description |
---|
IOUtils() |
Modifier and Type | Method and Description |
---|---|
static <K,T> T |
deserialize(byte[] bytes,
org.apache.avro.specific.SpecificDatumReader<T> datumReader,
org.apache.avro.Schema schema,
T object)
Deserializes the field object using the datumReader.
|
static <K,T extends org.apache.avro.specific.SpecificRecord> |
deserialize(byte[] bytes,
org.apache.avro.specific.SpecificDatumReader<T> datumReader,
org.apache.avro.Schema schema,
T object)
Deserializes the field object using the datumReader.
|
static <T> T |
deserialize(org.apache.hadoop.conf.Configuration conf,
byte[] in,
T obj)
Deserializes the object in the given datainput using
available Hadoop serializations.
|
static <T> T |
deserialize(org.apache.hadoop.conf.Configuration conf,
DataInput in,
T obj)
Deserializes the object in the given datainput using
available Hadoop serializations.
|
static <T> T |
deserialize(org.apache.hadoop.conf.Configuration conf,
DataInput in,
T obj,
Class<T> objClass)
Deserializes the object in the given datainput using
available Hadoop serializations.
|
static <T> T |
deserialize(org.apache.hadoop.conf.Configuration conf,
DataInput in,
T obj,
String objClass)
Deserializes the object in the given datainput using
available Hadoop serializations.
|
static <K,T extends org.apache.avro.specific.SpecificRecord> |
deserialize(InputStream is,
org.apache.avro.specific.SpecificDatumReader<T> datumReader,
org.apache.avro.Schema schema,
T object)
Deserializes the field object using the datumReader.
|
static byte[] |
getAsBytes(List<ByteBuffer> buffers)
Copies the contents of the buffers into a single byte[]
|
static <T> T |
loadFromConf(org.apache.hadoop.conf.Configuration conf,
String dataKey)
Loads the object stored by
storeToConf(Object, Configuration, String)
method from the configuration under the given dataKey. |
static boolean[] |
readBoolArray(DataInput in)
Reads a boolean[] from input
|
static boolean[] |
readBoolArray(org.apache.avro.io.Decoder in)
Reads a boolean[] from input
|
static byte[] |
readFully(InputStream in)
Reads until the end of the input stream, and returns the contents as a byte[]
|
static boolean[] |
readNullFieldsInfo(DataInput in)
Reads the data written by
writeNullFieldsInfo(DataOutput, Object...)
and returns a boolean array representing whether each field is null or not. |
static Object |
readObject(DataInput in) |
static String[] |
readStringArray(DataInput in)
Reads and returns a String array that is written by
writeStringArray(DataOutput, String[]) . |
static <T> void |
serialize(org.apache.hadoop.conf.Configuration conf,
DataOutput out,
T obj)
Serializes the object to the given dataoutput using
available Hadoop serializations
|
static <T> void |
serialize(org.apache.hadoop.conf.Configuration conf,
DataOutput out,
T obj,
Class<T> objClass)
Serializes the object to the given dataoutput using
available Hadoop serializations
|
static <T> byte[] |
serialize(org.apache.hadoop.conf.Configuration conf,
T obj)
Serializes the object to the given dataoutput using
available Hadoop serializations
|
static <T> void |
serialize(OutputStream os,
org.apache.avro.specific.SpecificDatumWriter<T> datumWriter,
org.apache.avro.Schema schema,
T object)
Serializes the field object using the datumWriter.
|
static <T extends org.apache.avro.specific.SpecificRecord> |
serialize(OutputStream os,
org.apache.avro.specific.SpecificDatumWriter<T> datumWriter,
org.apache.avro.Schema schema,
T object)
Serializes the field object using the datumWriter.
|
static <T> byte[] |
serialize(org.apache.avro.specific.SpecificDatumWriter<T> datumWriter,
org.apache.avro.Schema schema,
T object)
Serializes the field object using the datumWriter.
|
static <T extends org.apache.avro.specific.SpecificRecord> |
serialize(org.apache.avro.specific.SpecificDatumWriter<T> datumWriter,
org.apache.avro.Schema schema,
T object)
Serializes the field object using the datumWriter.
|
static <T> void |
storeToConf(T obj,
org.apache.hadoop.conf.Configuration conf,
String dataKey)
Stores the given object in the configuration under the given dataKey
|
static void |
writeBoolArray(DataOutput out,
boolean[] boolArray)
Writes a boolean[] to the output.
|
static void |
writeBoolArray(org.apache.avro.io.Encoder out,
boolean[] boolArray)
Writes a boolean[] to the output.
|
static void |
writeNullFieldsInfo(DataOutput out,
Object... fields)
Writes a byte[] to the output, representing whether each given field is null
or not.
|
static void |
writeObject(DataOutput out,
Object obj) |
static void |
writeStringArray(DataOutput out,
String[] arr)
Writes the String array to the given DataOutput.
|
public static final int BUFFER_SIZE
public static Object readObject(DataInput in) throws ClassNotFoundException, IOException
ClassNotFoundException
IOException
public static void writeObject(DataOutput out, Object obj) throws IOException
IOException
public static <T> void serialize(org.apache.hadoop.conf.Configuration conf, DataOutput out, T obj, Class<T> objClass) throws IOException
IOException
public static <T> void serialize(org.apache.hadoop.conf.Configuration conf, DataOutput out, T obj) throws IOException
IOException
public static <T> byte[] serialize(org.apache.hadoop.conf.Configuration conf, T obj) throws IOException
IOException
public static <T extends org.apache.avro.specific.SpecificRecord> void serialize(OutputStream os, org.apache.avro.specific.SpecificDatumWriter<T> datumWriter, org.apache.avro.Schema schema, T object) throws IOException
IOException
public static <T> void serialize(OutputStream os, org.apache.avro.specific.SpecificDatumWriter<T> datumWriter, org.apache.avro.Schema schema, T object) throws IOException
IOException
public static <T extends org.apache.avro.specific.SpecificRecord> byte[] serialize(org.apache.avro.specific.SpecificDatumWriter<T> datumWriter, org.apache.avro.Schema schema, T object) throws IOException
IOException
public static <T> byte[] serialize(org.apache.avro.specific.SpecificDatumWriter<T> datumWriter, org.apache.avro.Schema schema, T object) throws IOException
IOException
public static <T> T deserialize(org.apache.hadoop.conf.Configuration conf, DataInput in, T obj, String objClass) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static <T> T deserialize(org.apache.hadoop.conf.Configuration conf, DataInput in, T obj, Class<T> objClass) throws IOException
IOException
public static <T> T deserialize(org.apache.hadoop.conf.Configuration conf, DataInput in, T obj) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static <T> T deserialize(org.apache.hadoop.conf.Configuration conf, byte[] in, T obj) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static <K,T extends org.apache.avro.specific.SpecificRecord> T deserialize(InputStream is, org.apache.avro.specific.SpecificDatumReader<T> datumReader, org.apache.avro.Schema schema, T object) throws IOException
IOException
public static <K,T extends org.apache.avro.specific.SpecificRecord> T deserialize(byte[] bytes, org.apache.avro.specific.SpecificDatumReader<T> datumReader, org.apache.avro.Schema schema, T object) throws IOException
IOException
public static <K,T> T deserialize(byte[] bytes, org.apache.avro.specific.SpecificDatumReader<T> datumReader, org.apache.avro.Schema schema, T object) throws IOException
IOException
public static void writeNullFieldsInfo(DataOutput out, Object... fields) throws IOException
out
- the output to write tofields
- the fields to check for nullIOException
readNullFieldsInfo(DataInput)
public static boolean[] readNullFieldsInfo(DataInput in) throws IOException
writeNullFieldsInfo(DataOutput, Object...)
and returns a boolean array representing whether each field is null or not.in
- the input to read fromIOException
public static void writeBoolArray(DataOutput out, boolean[] boolArray) throws IOException
IOException
public static boolean[] readBoolArray(DataInput in) throws IOException
IOException
public static void writeBoolArray(org.apache.avro.io.Encoder out, boolean[] boolArray) throws IOException
IOException
public static boolean[] readBoolArray(org.apache.avro.io.Decoder in) throws IOException
IOException
public static void writeStringArray(DataOutput out, String[] arr) throws IOException
out
- the data output to write toarr
- the array to writeIOException
readStringArray(DataInput)
public static String[] readStringArray(DataInput in) throws IOException
writeStringArray(DataOutput, String[])
.in
- the data input to read fromIOException
public static <T> void storeToConf(T obj, org.apache.hadoop.conf.Configuration conf, String dataKey) throws IOException
obj
- the object to storeconf
- the configuration to store the object intodataKey
- the key to store the dataIOException
public static <T> T loadFromConf(org.apache.hadoop.conf.Configuration conf, String dataKey) throws IOException
storeToConf(Object, Configuration, String)
method from the configuration under the given dataKey.conf
- the configuration to read fromdataKey
- the key to get the data fromIOException
public static byte[] getAsBytes(List<ByteBuffer> buffers)
public static byte[] readFully(InputStream in) throws IOException
IOException
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.