geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <dsundst...@gluecode.com>
Subject Re: Zip Files and Endian-ness
Date Thu, 04 Nov 2004 18:26:59 GMT
The endianness should not matter when reading the byte, but I could be 
wrong.  Anyway, I got the same results on my mac:

B1: 50
B2: 4b
B3: 3
B4: 4
Int: 504b0304

-dain

--
Dain Sundstrom
Chief Architect
Gluecode Software
310.536.8355, ext. 26

On Nov 4, 2004, at 10:02 AM, Aaron Mulder wrote:

> 	I'm trying to detect a Zip file.  On an Intel/AMD platform, the
> first 4 bytes are (hex) 50-4b-03-04.  I wonder if the order is 
> different
> on a differently-endian platform.  Can someone look at a ZIP file on,
> what, a Solaris box I guess, and let me know what order the first 4 
> bytes
> are?  Maybe a Mac is different?  I forget.  Here's a little test class.
>
> Thanks,
> 	Aaron
>
> import java.io.*;
> public class ZipTest {
>     public static void main(String[] args) {
>         try {
>             FileInputStream in = new FileInputStream(args[0]);
>             System.out.println("B1: "+Integer.toHexString(in.read()));
>             System.out.println("B2: "+Integer.toHexString(in.read()));
>             System.out.println("B3: "+Integer.toHexString(in.read()));
>             System.out.println("B4: "+Integer.toHexString(in.read()));
>             in.close();
>             in = new FileInputStream(args[0]);
>             System.out.println("Int: "+Integer.toHexString(
>                 new DataInputStream(in).readInt()));
>             in.close();
>         } catch (IOException e) {
>             e.printStackTrace();
>         }
>     }
> }
>
> PC Results
> ----------
> B1: 50
> B2: 4b
> B3: 3
> B4: 4
> Int: 504b0304


Mime
View raw message