Example usage for org.apache.hadoop.typedbytes TypedBytesInput readVector

List of usage examples for org.apache.hadoop.typedbytes TypedBytesInput readVector

Introduction

In this page you can find the example usage for org.apache.hadoop.typedbytes TypedBytesInput readVector.

Prototype

@SuppressWarnings("unchecked")
public ArrayList readVector() throws IOException 

Source Link

Document

Reads the vector following a Type.VECTOR code.

Usage

From source file:fm.last.pigtail.storage.TypedBytesSequenceFileLoader.java

License:Apache License

@Override
public Tuple bytesToTuple(byte[] b) throws IOException {
    ByteArrayInputStream bais = new ByteArrayInputStream(b);
    DataInputStream dis = new DataInputStream(bais);
    TypedBytesInput tbin = TypedBytesInput.get(dis);
    if (tbin.readType() != org.apache.hadoop.typedbytes.Type.VECTOR) {
        throw new FrontendException("Type code does not correspond to vector.");
    }//from   w w  w  . j  ava2  s .co m
    Tuple result = tupleFactory.newTuple();
    for (Object item : tbin.readVector()) {
        result.append(item);
    }
    return result;
}