s1ni5t3r
s1ni5t3r

Reputation: 701

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?

Upvotes: 6

Views: 4896

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533870

DataInputStream is only big endian.

If you use ByteBuffer you can change the endianness with

buffer.order(ByteOrder.LITTLE_ENDIAN);

Upvotes: 14

Related Questions