I am reading a bunch of bytes from a binary file. This is a rar file. I'm interested in the 11th and 12th bytes of the file, as the header specification states:
HEAD_FLAGS Bit Flags: 2 bytes
0x0001 - Volume attribute (archive volume)
0x0002 - Archive comment present
RAR 3.x uses the separate comment block
and does not set this flag.
0x0004 - Archive lock attribute
0x0008 - Solid attribute (solid archive)
0x0010 - New volume naming scheme ('volname.partN.rar')
0x0020 - Authenticity information present
RAR 3.x does not set this flag.
0x0040 - Recovery record present
0x0080 - Block headers are encrypted
0x0100 - First volume (set only by RAR 3.0 and later)
other bits in HEAD_FLAGS are reserved for
internal use
File in which I play is 00and 0Dhow to position 11 and 12 respectively.
I cannot understand these two values ββbecause they are bit flags (which I did not understand).
I have these two values ββin an array bytewhose length is 12 bytes. What I need to check in this sequence: is the 0x0100and flag set 0x0001.
I have lost it. Thank.
Hex-, , , , 11- 12- . - . .
/, :
FileInputStream fisFileInputStream = new FileInputStream((new File("C:\\testarchive.r00"));
byte[] bytHeader = new byte[20];
fisFileInputStream.read(bytHeader);
short val=(short)( ((bytHeader[10]&0xFF)<<8) | (bytHeader[11]&0xFF) );
System.out.println("Volume Attribute (0x0001): " + ((val & 0x0001) != 0));
System.out.println("First volume (0x0100): " + ((val & 0x0100) != 0));
RAR- - , , , .
, . , ..
, , atrribute 0x0001 (false), " " 0x100 (true).
, , .
, , ( ) 0x0001 , , 0x0100 , , .
.. , - . ?