cafebabe revision 192348
1126667Sphk#------------------------------------------------------------------------------
2126667Sphk# Cafe Babes unite!
3126667Sphk#
4126667Sphk# Since Java bytecode and Mach-O fat-files have the same magic number, the test
5126667Sphk# must be performed in the same "magic" sequence to get both right.  The long
6126667Sphk# at offset 4 in a mach-O fat file tells the number of architectures; the short at
7126667Sphk# offset 4 in a Java bytecode file is the JVM minor version and the
8126667Sphk# short at offset 6 is the JVM major version.  Since there are only 
9126667Sphk# only 18 labeled Mach-O architectures at current, and the first released 
10126667Sphk# Java class format was version 43.0, we can safely choose any number
11126667Sphk# between 18 and 39 to test the number of architectures against
12126667Sphk# (and use as a hack). Let's not use 18, because the Mach-O people
13126667Sphk# might add another one or two as time goes by...
14126667Sphk#
15126667Sphk0	belong		0xcafebabe
16126667Sphk!:mime	application/x-java-applet
17126667Sphk>4	belong		>30		compiled Java class data,
18126667Sphk>>6	beshort		x	        version %d.
19>>4	beshort		x       	\b%d
20# Which is which?
21#>>4	belong		0x032d		(Java 1.0)
22#>>4	belong		0x032d		(Java 1.1)
23>>4	belong		0x002e		(Java 1.2)
24>>4	belong		0x002f		(Java 1.3)
25>>4	belong		0x0030		(Java 1.4)
26>>4	belong		0x0031		(Java 1.5)
27>>4	belong		0x0032		(Java 1.6)
28
29
300	belong		0xcafebabe
31>4	belong		1		Mach-O fat file with 1 architecture
32>4	belong		>1
33>>4	belong		<20		Mach-O fat file with %ld architectures
34
350	belong		0xcafed00d	JAR compressed with pack200,
36>>5	byte		x		version %d.
37>>4	byte		x		\b%d
38!:mime	application/x-java-pack200
39