Endianness on DataInputStream

旧时模样 提交于 2019-12-12 11:14:26

问题


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?


回答1:


DataInputStream is only big endian.

If you use ByteBuffer you can change the endianness with

buffer.order(ByteOrder.LITTLE_ENDIAN);


来源:https://stackoverflow.com/questions/13211770/endianness-on-datainputstream

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!