2

I'm trying to read in a .zip file that holds a compressed .txt file. How can I check for the magic number 0x00BC? Thanks.

Edit: Sorry, should have specified that I'm trying to do this in java.

user2901181
  • 343
  • 4
  • 17

1 Answers1

0

First two bytes from the ZIP file:

InputStream is = new FileInputStream(FILE NAME);
byte b1 = (byte)is.read();
byte b2 = (byte)is.read();
is.close();

First two bytes from the first compressed file:

InputStream is = new FileInputStream(FILE NAME);
ZipInputStream zis = new ZipInputStream(is);
zis.getNextEntry();
byte[] bytes = new byte[2];
zis.read(bytes, 0, 2);
zis.close();
Fedy2
  • 3,147
  • 4
  • 26
  • 44