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

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

Introduction

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

Prototype

public float readFloat() throws IOException 

Source Link

Document

Reads the float following a Type.FLOAT code.

Usage

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

License:Apache License

@Override
public Float bytesToFloat(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.FLOAT) {
        throw new FrontendException("Type code does not correspond to float.");
    }//from  w ww  .ja va2 s.c o  m
    return tbin.readFloat();
}