سؤال

I hava a binary file like this :

offset | size/type | Description
-------+-----------+-----------------------------------------------------------
0x0000 | 28 chars  | zero terminated string
0x001c |  1 dword  | fileoffset of first compressed data block (header size)
0x0020 |  1 dword  | overall size of compressed file

I can read the 28 chars as a String. But I don't know how to read a dword and store it as an int.

هل كانت مفيدة؟

المحلول

DataInputStream.readFully() and .readInt(). You may have to do something about the (unspecified) byte order though. If that's an issue, ByteBuffer.getInt(), after setting the appropriate byte order.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top