cafebabe 1.2 KB

123456789101112131415161718192021222324252627
  1. #------------------------------------------------------------------------------
  2. # Cafe Babes unite!
  3. #
  4. # Since Java bytecode and Mach-O fat-files have the same magic number, the test
  5. # must be performed in the same "magic" sequence to get both right. The long
  6. # at offset 4 in a mach-O fat file tells the number of architectures; the short at
  7. # offset 4 in a Java bytecode file is the JVM minor version and the
  8. # short at offset 6 is the JVM major version. Since there are only
  9. # only 18 labeled Mach-O architectures at current, and the first released
  10. # Java class format was version 43.0, we can safely choose any number
  11. # between 18 and 39 to test the number of architectures against
  12. # (and use as a hack). Let's not use 18, because the Mach-O people
  13. # might add another one or two as time goes by...
  14. #
  15. 0 beshort 0xcafe
  16. >2 beshort 0xbabe
  17. !:mime application/x-java-applet
  18. >>2 belong >30 compiled Java class data,
  19. >>>6 beshort x version %d.
  20. >>>4 beshort x \b%d
  21. >>4 belong 1 Mach-O fat file with 1 architecture
  22. >>4 belong >1
  23. >>>4 belong <20 Mach-O fat file with %ld architectures
  24. >2 beshort 0xd00d JAR compressed with pack200,
  25. >>5 byte x version %d.
  26. >>4 byte x \b%d
  27. !:mime application/x-java-pack200