hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike S <mikesam...@gmail.com>
Subject Read Little Endian Input File Format
Date Mon, 09 Jul 2012 20:33:04 GMT
The input file to my M/R job is a file with binary data (20 mix of
int, long, float and double per record) which are all saved in little
endian. I have implement my custom record reader to read a record and
to do so I am currently using the ByteBuffer to convert every entry in
the file. I am wondering if there is a more efficient way of doing?

public void readFields(DataInput dataInput) throws IOException
{
		byte[] buffer = new byte[4];
		dataInput.readFully(buffer);
		fieldA.set(ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN).getInt());

                ....
                ....

}

Mime
View raw message