On Mon, Jul 9, 2012 at 1:33 PM, Mike S <mikesam...@gmail.com> wrote: > 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? >
I would either make a large ByteBuffer and read into it or use: // read big endian int int val = in.readInt(); // flip to little endian val = ((val & 0xff) << 24) | ((val & 0xff00 << 8) | ((val & 0xff0000) >> 8) | (val >>> 24); -- Owen