简体   繁体   English

DataInputStream上的字节顺序

[英]Endianness on DataInputStream

I have a file format that I want to load that contains raw data for OpenGL objects. 我有一个我想要加载的文件格式,其中包含OpenGL对象的原始数据。

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? 是否有一个java类完成DataInputStream的确切工作,但使用小端或者我必须逐字节加载它并自己执行转换?

DataInputStream is only big endian. DataInputStream只是大端。

If you use ByteBuffer you can change the endianness with 如果使用ByteBuffer,则可以使用。更改字节序

buffer.order(ByteOrder.LITTLE_ENDIAN);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM