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/textui/XMLUISummary.java
package com.kirkk.analyzer.textui; import java.io.*; import java.util.*; import com.kirkk.analyzer.framework.*; import com.kirkk.analyzer.*; /* * Modified version of XMLUISummary * http://www.kirkk.com/wiki/wiki.php/Main/JarAnalyzer * * This class takes the input directory and output file * from the command line or from System.in. It is also * usable directly from Java and can be called from * an ant task */ public class XMLUISummary implements Summary { private PrintWriter writer; public static void main(String args[]) throws Exception { new XMLUISummary().instanceMain(args); } public void instanceMain(String args[]) throws Exception { File scrDir = (args.length > 0) ? new File(args[0]) : null; File destFile = (args.length > 1) ? new File(args[1]) : null; if(scrDir == null) { System.out.print("Please enter input directory name: "); scrDir = getFile(); } if(destFile == null) { System.out.print("Please enter output file name: "); destFile = getFile(); } createSummary(scrDir, destFile); } public void createSummary(File srcDir, File destFile) throws Exception { Analyzer analyzer = new Analyzer(); Jar jarBundle[] = analyzer.analyze(srcDir); outputAll(jarBundle, destFile); } public void createSummary(File srcDir, File destFile, String packageFilter, String jarFilter) throws Exception { Analyzer analyzer = new Analyzer(); Configuration.initialize(packageFilter, jarFilter); Jar jarBundle[] = analyzer.analyze(srcDir); outputAll(jarBundle, destFile); } private File getFile() throws IOException { try { InputStreamReader streamReader = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(streamReader); String fileName = reader.readLine(); File file = new File(fileName); return file; } catch (IOException e) { throw e; } } private void outputAll(Jar[] jarBundle, File file) { try { FileWriter fileWriter = new FileWriter(file); writer = new PrintWriter(fileWriter); } catch (IOException e) { System.out.println("IOException - Redirecting to System.out"); System.out.println(e); OutputStreamWriter outputWriter = new OutputStreamWriter(System.out); writer = new PrintWriter(outputWriter); } this.printHeader(); this.output(jarBundle); this.printFooter(); writer.flush(); writer.close(); } private void printHeader() { writer.println("<?xml version=\"1.0\"?>"); writer.println("<JarAnalyzer>"); } private void printFooter() { writer.println("</JarAnalyzer>"); } private void output(Jar[] jarBundles) { writer.println(tab()+"<Jars>");writer.println(); for (int i = 0; i < jarBundles.length; i++) { String jar = jarBundles[i].getJarFileName().substring(jarBundles[i].getJarFileName().lastIndexOf("\\") + 1, jarBundles[i].getJarFileName().length()); writer.println(tab(2)+"<Jar name=\"" + jar + "\">"); writer.println(tab(3)+"<Summary>"); this.statistics(jarBundles[i]);writer.println(); this.metrics(jarBundles[i].calculateMetrics());writer.println(); this.jarPackages(jarBundles[i]);writer.println(); this.outgoingDependencies(jarBundles[i]); this.incomingDependencies(jarBundles[i]); this.cycles(jarBundles[i]); this.unresolveableDependencies(jarBundles[i]); writer.println(tab(3)+"</Summary>");writer.println(); writer.println(tab(2)+"</Jar>");writer.println(); } writer.println(tab()+"</Jars>"); } private void statistics(Jar jarBundle) { writer.println(tab(4)+"<Statistics>"); writer.println(tab(5)+"<ClassCount>" + jarBundle.getClassCount() + "</ClassCount>"); writer.println(tab(5)+"<AbstractClassCount>" + jarBundle.getAbstractClassCount() + "</AbstractClassCount>"); writer.println(tab(5)+"<PackageCount>" + jarBundle.getPackageCount() + "</PackageCount>"); //writer.println(tab(5)+"<Level>" + jarBundle.getLevel() + "</Level>"); writer.println(tab(4)+"</Statistics>"); } private void metrics(JarMetrics jarMetrics) { writer.println(tab(4)+"<Metrics>"); writer.println(tab(5)+"<Abstractness>" + jarMetrics.calculateAbstractness().toString() + "</Abstractness>"); writer.println(tab(5)+"<Efferent>" + jarMetrics.calculateEfferentCoupling() + "</Efferent>"); writer.println(tab(5)+"<Afferent>" + jarMetrics.calculateAfferentCoupling() + "</Afferent>"); writer.println(tab(5)+"<Instability>" + jarMetrics.calculateInstability().toString() + "</Instability>"); writer.println(tab(5)+"<Distance>" + jarMetrics.calculateDistance().toString() + "</Distance>"); writer.println(tab(4)+"</Metrics>"); } private void cycles(Jar jarBundle) { writer.println(tab(4) + "<Cycles>"); if (jarBundle.hasCycles()) { Iterator cyclicJars = jarBundle.getCyclicJars().iterator(); while (cyclicJars.hasNext()) { Jar cyclicBundle = (Jar) cyclicJars.next(); String jarName = cyclicBundle.getJarFileName(); writer.println(tab(5) + "<Cycle>" + jarName + "</Cycle>"); } } writer.println(tab(4) + "</Cycles>");writer.println(); } private void outgoingDependencies(Jar jarBundle) { writer.println(tab(4)+"<OutgoingDependencies>"); Iterator jarDependencies = jarBundle.getOutgoingDependencies().iterator(); while (jarDependencies.hasNext()) { Jar dependentBundle = (Jar) jarDependencies.next(); //String jar2 = dependentBundle.getJarFileName().substring(dependentBundle.getJarFileName().lastIndexOf("\\") + 1, // dependentBundle.getJarFileName().length()); String jar2= dependentBundle.getJarFileName(); writer.println(tab(5)+"<Jar>"+jar2+"</Jar>"); } writer.println(tab(4)+"</OutgoingDependencies>");writer.println(); } private void incomingDependencies(Jar jarBundle) { writer.println(tab(4)+"<IncomingDependencies>"); Iterator jarDependencies = jarBundle.getIncomingDependencies().iterator(); while (jarDependencies.hasNext()) { Jar dependentBundle = (Jar) jarDependencies.next(); //String jar2 = dependentBundle.getJarFileName().substring(dependentBundle.getJarFileName().lastIndexOf("\\") + 1, // dependentBundle.getJarFileName().length()); String jar2= dependentBundle.getJarFileName(); writer.println(tab(5)+"<Jar>"+jar2+"</Jar>"); } writer.println(tab(4)+"</IncomingDependencies>");writer.println(); } private void externalDependencies(Jar jarBundle) { Iterator allPackages = jarBundle.getAllExternallyReferencedPackages().iterator(); while (allPackages.hasNext()) { String javaPackage = (String) allPackages.next(); writer.println(tab(5)+"<Package>"+javaPackage+"</Package>"); } } private void unresolveableDependencies(Jar jarBundle) { writer.println(tab(4)+"<UnresolvedDependencies>"); Iterator unresolvedPackages = jarBundle.getAllUnidentifiableExternallyReferencedPackages().iterator(); while (unresolvedPackages.hasNext()) { String packageName = (String) unresolvedPackages.next(); writer.println(tab(5)+"<Package>"+packageName+"</Package>"); } writer.println(tab(4)+"</UnresolvedDependencies>"); } private void jarPackages(Jar jarBundle) { writer.println(tab(4)+"<Packages>"); Iterator allPackages = jarBundle.getAllContainedPackages().iterator(); while (allPackages.hasNext()) { JarPackage javaPackage = (JarPackage) allPackages.next(); writer.println(tab(5)+"<Package>" + javaPackage.getLongName() + "</Package>"); } writer.println(tab(4)+"</Packages>"); } private String tab() { return " "; } private String tab(int i) { String tab = tab(); for (int j = 0; j < i - 1; j++) { tab = tab + tab(); } return tab; } }
⏎ com/kirkk/analyzer/textui/XMLUISummary.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, 5583👍, 0💬
Popular Posts:
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...
What JAR files are required to run sax\Writer.java provided in the Apache Xerces package? 1 JAR file...
What Is poi-ooxml-5.2.3.jar? poi-ooxml-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.0.2? The if y...