1 2 3 4 5 | SourceDebugExtension_attribute { u2 attribute_name_index; u4 attribute_length; u1 debug_extension[attribute_length]; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public static void main(String[] args) throws Exception{ String[]files = { "E:\\Tomcat5_0_5\\work\\Catalina\\localhost\\_\\org\\apache\\jsp\\Hello_jsp.class", }; for(int k = 0; k < files.length; k++){ String file = files[k]; System.out.println("Class : " + file); ClassFile classFile = new ClassFile(new DataInputStream(new FileInputStream(file))); AttributeInfo attributeInfo = classFile.getAttribute("SourceDebugExtension"); System.out.println("attribute name :" + attributeInfo.getName() + "]\n\n"); byte[]bytes = attributeInfo.get(); String str = new String(bytes); System.out.println(str); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | SMAP E:\Tomcat5_0_5\work\Catalina\localhost\_\org\apache\jsp\Hello_jsp.java JSP *S JSP *F + 0 Hello.jsp /Hello.jsp + 1 greeting.jsp /greeting.jsp *L 1:45 2:46 3:47 3:48 4:49 5:50 1#1:51 1:52 2:53 7#0:56 8:57 *E |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1:45 2:46 3:47 3:48 4:49 5:50(没有源文件代号,默认为Hello.jsp) 开始行号 结束行号 Hello.jsp: 1 -> Hello_jsp.java: 45 2 -> 46 3 -> 47 48 4 -> 49 5 -> 50 1#1:51 1:52 2:53(1#1表示 greeting.jsp 的第1行) greeting.jsp: 1 -> Hello_jsp.java: 51 52 2 -> 53 7#0:56 8:57(7#0表示 Hello.jsp 的第7行) Hello.jsp: 7 -> Hello_jsp.java: 56 8 -> 57 |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |