Example usage for org.apache.hadoop.io ArrayWritable write

List of usage examples for org.apache.hadoop.io ArrayWritable write

Introduction

In this page you can find the example usage for org.apache.hadoop.io ArrayWritable write.

Prototype

@Override
    public void write(DataOutput out) throws IOException 

Source Link

Usage

From source file:com.mozilla.hadoop.hbase.mapreduce.MultiScanTableMapReduceUtil.java

License:Apache License

/**
 * Converts an array of Scan objects into a base64 string
 * @param scans//from  w  ww . j av a2  s  .  c  om
 * @return
 * @throws IOException
 */
public static String convertScanArrayToString(final Scan[] scans) throws IOException {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final DataOutputStream dos = new DataOutputStream(baos);

    ArrayWritable aw = new ArrayWritable(Scan.class, scans);
    aw.write(dos);

    return Base64.encodeBytes(baos.toByteArray());
}