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/jar/JarFile.java

package com.kirkk.analyzer.framework.jar;

import java.io.*;
import java.util.zip.*;
import java.util.*;

public class JarFile {
	private HashMap jarContents;
	private Enumeration jarEntries;
    private ZipFile zipFile;
	private String nextClass;
	private File file;

	public JarFile(File file)  throws ZipException, IOException {
		this.file = file;
        this.zipFile =  new ZipFile(file);
		this.jarEntries = zipFile.entries();
	}

	public boolean hasMoreClasses() {
		boolean classFileFound = false;
		ZipEntry nextEntry = null;
		while (jarEntries.hasMoreElements() && (classFileFound == false) ) {
			nextEntry = (ZipEntry) jarEntries.nextElement();
			if ( (nextEntry.getName().endsWith(".class")) ) {
				classFileFound = true;
			}
		}
		if (classFileFound) {
			this.nextClass = nextEntry.getName();
			return true;
		} else {
			this.nextClass = null;
			return false;
		}
	}

	public String nextClass() {
		return this.nextClass;
	}

	public String getFileName() {
		return this.file.getAbsolutePath();
	}

	public String getShortFileName() {
		return this.file.getName();
	}

    public void close() {
        if(null != zipFile) {
            try {
                zipFile.close();
            }
            catch (IOException exc) {
                exc.printStackTrace();
            }
        }
    }
}

com/kirkk/analyzer/framework/jar/JarFile.java

 

 

⇒ jarscan - JAR File Scanner

⇐ Download JarAnalyzer Source Package

⇑ JarAnalyzer by Kirk Knoernschild

⇑⇑ Java/JAR Tools

2021-07-01, 2499👍, 0💬