static final public int MAGIC = 0xCAFEBABE. // 传递C:\code\hacks\research\com\generationjava\Hack.class // 假定存在这样一个类 public String getFullyQualifiedName(String filename) throws IOException { String name = null.
try { DataInputStream in = new DataInputStream(new FileInputStream(filename)). if(in.readInt() != MAGIC) { // 不是一个.class文件 thrownew IOException("Not a class file"). }