Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Endianness on DataInputStream

I have a file format that I want to load that contains raw data for OpenGL objects.

All would be well but that data is encoded little endian.

Is there a java class that does the exact job of DataInputStream but using little endian or do I have to load it byte by byte and perform the conversions myself?

like image 515
s1ni5t3r Avatar asked Nov 03 '12 17:11

s1ni5t3r


1 Answers

DataInputStream is only big endian.

If you use ByteBuffer you can change the endianness with

buffer.order(ByteOrder.LITTLE_ENDIAN);
like image 134
Peter Lawrey Avatar answered Oct 05 '22 04:10

Peter Lawrey