Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JarAnalyzer Source Code Files
Apache Ant Source Code Files are inside the JarAnalyzer source package like JarAnalyzer-src-1.2.zip. Unzip the source package and go to the "src" sub-directory, you will see source code files.
Here is the list of Java source code files of the JarAnalyzer 1.2 in \Users\fyicenter\JarAnalyzer\src:
✍: FYIcenter.com
⏎ com/kirkk/analyzer/framework/bcel/PackageVisitor.java
package com.kirkk.analyzer.framework.bcel; import org.apache.bcel.classfile.*; import java.util.*; public class PackageVisitor extends EmptyVisitor { private JavaClass javaClass; private ArrayList imports; private ArrayList strings; public PackageVisitor(JavaClass javaClass) { this.javaClass = javaClass; //System.out.println("PackageVisitor constructor: " + javaClass.getClassName()); this.imports = new ArrayList(); this.strings = new ArrayList(); } public void visitConstantClass(ConstantClass cls) { //System.out.println("CONSTANTCLASS: " + cls.getBytes(this.pool)); String sCls = cls.getBytes(this.javaClass.getConstantPool()); if (sCls.indexOf("/") != -1) { //sCls = sCls.substring(0, sCls.lastIndexOf(".")); sCls = this.stripClassName(sCls); sCls = sCls.replace('/', '.'); sCls = this.cleanClass(sCls); if (!this.imports.contains(sCls) && (!this.javaClass.getPackageName().equals(sCls))) { this.imports.add(sCls); } } } public void visitConstantUtf8(ConstantUtf8 utf) { //System.out.println("UTF8: " + utf.getBytes()); //System.out.println("UTF8 Strng: " + utf.toString()); String utfString = utf.toString().substring(utf.toString().indexOf('"') + 1,utf.toString().lastIndexOf('"')); //System.out.println("FIXED: " + utfString); if (isValidJavaClass(utfString)) { if (!this.strings.contains(utfString)) { String[] classes = this.separateClasses(utfString); for (int i = 0; i < classes.length; i++) { if (classes[i] != null) { String cls = classes[i]; String packageName = this.stripClassName(cls); packageName = packageName.replace('/', '.'); String cleanedPackage = this.cleanClass(packageName); //System.out.println("UTF " + cls); if (!this.imports.contains(cleanedPackage) && (!this.javaClass.getPackageName().equals(cleanedPackage))) { this.imports.add(cleanedPackage); } } } } } } public void visitConstantString(ConstantString str) { //System.out.println("CONSTANTSTRING: " + str.getBytes(this.pool)); this.strings.add(str.getBytes(this.javaClass.getConstantPool()).toString()); } private boolean isValidJavaClass(String cls) { if (cls.indexOf("/") == -1) { return false; } if ( (!cls.startsWith("(")) && (!cls.startsWith("L")) ) { return false; } if ( (!cls.endsWith("V")) && (!cls.endsWith(";")) && (!cls.endsWith(")")) ) { return false; } return true; } private String[] separateClasses(String utfString) { StringTokenizer tokenizer = new StringTokenizer(utfString, ";"); String classes[] = new String[tokenizer.countTokens()]; int i = 0; while (tokenizer.hasMoreTokens()) { String cls = tokenizer.nextToken(); if (cls.indexOf('/') != -1) { classes[i] = cls; i++; } } return classes; } private String cleanClass(String cls) { int index = cls.lastIndexOf('L'); //int index = cls.indexOf('L'); String newCls = cls; if (index != -1) { newCls = cls.substring(index + 1); } return newCls; } private String stripClassName(String cls) { //String strippedName = cls.substring(0, cls.lastIndexOf(".")); String strippedName = cls.substring(0, cls.lastIndexOf("/")); return strippedName; } public List getAllImports() { return this.imports; } public List getImports(List ignorePackages) { Iterator i = this.imports.iterator(); ArrayList imports = new ArrayList(); while (i.hasNext()) { String pkg = (String) i.next(); //System.out.println("IMPORT: " + pkg); if (ignorePackages.isEmpty() == false) { Iterator filter = ignorePackages.iterator(); boolean filterPackage = false; while (filter.hasNext()) { String packageFilter = (String) filter.next(); if (pkg.startsWith(packageFilter)) { filterPackage = true; } } if (!filterPackage) { imports.add(pkg); } } else { imports.add(pkg); } } return imports; } }
⏎ com/kirkk/analyzer/framework/bcel/PackageVisitor.java
Or download all of them as a single archive file:
File name: JarAnalyzer-1.20-fyi.zip File size: 19949 bytes Release date: 2007-08-03 Download
⇐ Download JarAnalyzer Source Package
2021-07-01, 5017👍, 0💬
Popular Posts:
How to merge two JAR files with "jar" commands? I am tired of specifying multiple JAR files in the c...
How to display types defined in an XML Schema file with the xs\QueryXS.java provided in the Apache X...
What Is poi-scratchpad-3.5.jar? poi-scratchpad-3.5.jar is one of the JAR files for Apache POI 3.5, w...
Joda-Time provides a quality replacement for the Java date and time classes. The design allows for m...
What Is jaxb-impl-2.1.12.jar? Java Architecture for XML Binding (JAXB) is a Java API that allows Jav...