2 #------------------------------------------------------------------------------
3 # $File: cafebabe,v 1.17 2015/01/01 17:07:00 christos Exp $
6 # Since Java bytecode and Mach-O universal binaries have the same magic number,
7 # the test must be performed in the same "magic" sequence to get both right.
8 # The long at offset 4 in a Mach-O universal binary tells the number of
9 # architectures; the short at offset 4 in a Java bytecode file is the JVM minor
10 # version and the short at offset 6 is the JVM major version. Since there are only
11 # only 18 labeled Mach-O architectures at current, and the first released
12 # Java class format was version 43.0, we can safely choose any number
13 # between 18 and 39 to test the number of architectures against
14 # (and use as a hack). Let's not use 18, because the Mach-O people
15 # might add another one or two as time goes by...
19 >4 belong >30 compiled Java class data,
20 !:mime application/x-java-applet
21 >>6 beshort x version %d.
24 #>>4 belong 0x032d (Java 1.0)
25 #>>4 belong 0x032d (Java 1.1)
26 >>4 belong 0x002e (Java 1.2)
27 >>4 belong 0x002f (Java 1.3)
28 >>4 belong 0x0030 (Java 1.4)
29 >>4 belong 0x0031 (Java 1.5)
30 >>4 belong 0x0032 (Java 1.6)
32 0 belong 0xcafed00d JAR compressed with pack200,
35 !:mime application/x-java-pack200
38 0 belong 0xcafed00d JAR compressed with pack200,
41 !:mime application/x-java-pack200
52 >4 belong 1 Mach-O universal binary with 1 architecture:
55 >>4 belong <20 Mach-O universal binary with %d architectures: