标签:inpu 字节 开头 csdn val com plain png line
最近看到一篇文章,其中有一行代码是判断class文件类型的,代码片段:
InputStream is = new InputStream("Test.Class");DataInputStream dis; if (is instanceof DataInputStream) dis = (DataInputStream) is; else dis = new DataInputStream(is); if (dis.readInt() != 0xcafebabe) throw new IOException("not a .class file");if (dis.readInt() != 0xcafebabe),查阅相关资料,readInt()方法是读取输入流的四个字节,而class文件都是以CA FE BA BE 开头的,上图
标签:inpu 字节 开头 csdn val com plain png line
原文地址:https://www.cnblogs.com/chengu/p/10852325.html