[kaffe] CVS kaffe (robilad): removed unused org.kaffe.lang classes
Kaffe CVS
cvs-commits at kaffe.org
Sun Jul 16 16:43:25 PDT 2006
PatchSet 7360
Date: 2006/07/16 23:31:57
Author: robilad
Branch: HEAD
Tag: (none)
Log:
removed unused org.kaffe.lang classes
2006-07-17 Dalibor Topic <robilad at kaffe.org>
* libraries/javalib/vmspecific/org/kaffe/lang/ResourceReader.java,
libraries/javalib/vmspecific/org/kaffe/lang/ClassPathReader.java:
Removed unused classes.
Members:
ChangeLog:1.4864->1.4865
libraries/javalib/Makefile.am:1.445->1.446
libraries/javalib/Makefile.in:1.559->1.560
libraries/javalib/vmspecific/org/kaffe/lang/ClassPathReader.java:1.1->1.2(DEAD)
libraries/javalib/vmspecific/org/kaffe/lang/ResourceReader.java:1.1->1.2(DEAD)
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4864 kaffe/ChangeLog:1.4865
--- kaffe/ChangeLog:1.4864 Sun Jul 16 23:05:40 2006
+++ kaffe/ChangeLog Sun Jul 16 23:31:57 2006
@@ -1,3 +1,9 @@
+2006-07-17 Dalibor Topic <robilad at kaffe.org>
+
+ * libraries/javalib/vmspecific/org/kaffe/lang/ResourceReader.java,
+ libraries/javalib/vmspecific/org/kaffe/lang/ClassPathReader.java:
+ Removed unused classes.
+
2006-07-17 Riccardo Mottola <riccardo at kaffe.org>
* libraries/javalib/awt-implementations/kaffe/java/awt/Component.java:
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.445 kaffe/libraries/javalib/Makefile.am:1.446
--- kaffe/libraries/javalib/Makefile.am:1.445 Sun Jul 16 22:54:57 2006
+++ kaffe/libraries/javalib/Makefile.am Sun Jul 16 23:32:03 2006
@@ -277,9 +277,7 @@
vmspecific/java/util/zip/ZipOutputStream.java \
vmspecific/org/kaffe/jar/ExecJar.java \
vmspecific/org/kaffe/jar/ExecJarName.java \
- vmspecific/org/kaffe/lang/ClassPathReader.java \
vmspecific/org/kaffe/lang/PackageHelper.java \
- vmspecific/org/kaffe/lang/ResourceReader.java \
vmspecific/org/kaffe/lang/UNIXProcess.java \
vmspecific/org/kaffe/management/Classpath.java \
vmspecific/org/kaffe/management/Debug.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.559 kaffe/libraries/javalib/Makefile.in:1.560
--- kaffe/libraries/javalib/Makefile.in:1.559 Sun Jul 16 22:54:59 2006
+++ kaffe/libraries/javalib/Makefile.in Sun Jul 16 23:32:05 2006
@@ -590,9 +590,7 @@
vmspecific/java/util/zip/ZipOutputStream.java \
vmspecific/org/kaffe/jar/ExecJar.java \
vmspecific/org/kaffe/jar/ExecJarName.java \
- vmspecific/org/kaffe/lang/ClassPathReader.java \
vmspecific/org/kaffe/lang/PackageHelper.java \
- vmspecific/org/kaffe/lang/ResourceReader.java \
vmspecific/org/kaffe/lang/UNIXProcess.java \
vmspecific/org/kaffe/management/Classpath.java \
vmspecific/org/kaffe/management/Debug.java \
===================================================================
Checking out kaffe/libraries/javalib/vmspecific/org/kaffe/lang/ClassPathReader.java
RCS: /home/cvs/kaffe/kaffe/libraries/javalib/vmspecific/org/kaffe/lang/Attic/ClassPathReader.java,v
VERS: 1.1
***************
--- kaffe/libraries/javalib/vmspecific/org/kaffe/lang/ClassPathReader.java Sun Jul 16 23:43:25 2006
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,190 +0,0 @@
-package org.kaffe.lang;
-
-/**
- * This class implements the ResourceReader interface
- * based on a "CLASSPATH" which can be given as a parameter.
- *
- * @author Godmar Back (gback at cs.utah.edu)
- */
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-public
-class ClassPathReader implements ResourceReader
-{
- public static boolean debug;
- void log(String msg)
- {
- if (debug) {
- System.out.println("<ClassPathReader>: " + msg);
- }
- }
-
- /**
- * Components of this path
- */
- private Vector pathcomps; // strings or zipfiles
- private Vector pathcompsStr; // as strings
- private boolean cache; // should I cache bytecode?
-
- /**
- * Hashtable of already read classes
- */
- private Hashtable classcache;
-
- /**
- * Build a class path from the specified path string
- */
- public ClassPathReader(boolean cache, String pathstr)
- {
- this.cache = cache;
- if (cache) {
- classcache = new Hashtable();
- }
- pathcomps = new Vector(5,2);
- pathcompsStr = new Vector(5,2);
- Vector temp = new Vector(5,2);
-
- String s = pathstr;
- int i;
- while ((i = s.indexOf(File.pathSeparatorChar)) != -1) {
- if (i == 0)
- temp.addElement(".");
- else
- temp.addElement(s.substring(0, i));
- s = s.substring(i+1);
- }
- temp.addElement(s);
-
- /* now look for zip files and replace entries with ZipFiles */
- for (i = 0; i < temp.size(); i++) {
- s = (String)temp.elementAt(i);
- File f = new File(s);
- if ((s.endsWith(".jar") || s.endsWith(".zip")) && f.isFile()) {
- try {
- ZipFile zip = new ZipFile(s);
- pathcomps.addElement(zip);
- pathcompsStr.addElement(s);
- } catch (Exception ze) {
- }
- } else {
- if (f.isDirectory()) {
- pathcomps.addElement(s);
- pathcompsStr.addElement(s);
- }
- }
- }
- log("pathcompsStr = " + pathcompsStr);
- log("pathcomps = " + pathcomps);
- log("cache = " + cache);
- }
-
- public InputStream getResourceAsStream(String cname) {
- InputStream stream = null;
-
- // iterate through all components and look for file
- for (int i = 0; i < pathcomps.size(); i++) {
-
- Object comp = pathcomps.elementAt(i);
- if (comp instanceof String) {
- try {
- String fn = ((String)comp).concat("/").concat(cname);
-
- log("opening " + fn);
- // a regular file
- stream = new FileInputStream(fn);
- } catch (IOException ie1) {
- continue;
- }
- } else
- if (comp instanceof ZipFile) {
- try {
- ZipFile zip = (ZipFile)comp;
- ZipEntry entry = zip.getEntry(cname);
-
- log("entry for " + cname + " is " + entry);
-
- // avoid throwing and catching a null pointer exception
- if (entry == null)
- throw new Exception(cname + " not found in zip file");
-
- stream = zip.getInputStream(entry);
-
- } catch (Exception ie0) {
- continue;
- }
- }
-
- return (stream);
- }
- return (null);
- }
-
- /**
- * resolve a class name of the form foo.bar.baz
- *
- * @param classname fully qualified class name
- * @return byte[] array of bytes containing .class file
- */
- public byte[] getByteCode(String classname) throws Exception
- {
- byte [] p = null;
-
- // check in cache first if caching
- if (cache) {
- p = (byte [])classcache.get(classname);
- }
-
- if (p != null) {
- return p;
- }
-
- String cname = classname.replace('.', '/').concat(".class");
- BufferedInputStream file;
- file = new BufferedInputStream(getResourceAsStream(cname));
-
- if (file == null) {
- throw new Exception("Couldn't resolve class `"
- + classname + "'\n"
- + " in CLASSPATH " + this);
- }
-
- // now try to read the file
- p = new byte[file.available()];
- int bread = file.read(p);
- if (bread != p.length)
- throw new Exception("Short read for " + classname
- + " read " + bread + ", expected " + p.length);
-
- if (cache)
- classcache.put(cname, p);
- return (p);
- }
-
- /**
- * convert in printable form
- *
- * @return String describing this class path
- */
- public String toString() {
- return pathcompsStr.toString();
- }
-
- /** a test */
- public static void main(String a[]) throws Exception
- {
- ClassPathReader p =
- new ClassPathReader(true, System.getProperty("java.class.path"));
- System.out.println(p.getByteCode("java.lang.Object"));
- System.out.println(p.getByteCode("java.io.File"));
- System.out.println(p.getByteCode("kaffe.lang.ClassPathReader"));
- System.out.println(p.getByteCode("lalala"));
- }
-}
===================================================================
Checking out kaffe/libraries/javalib/vmspecific/org/kaffe/lang/ResourceReader.java
RCS: /home/cvs/kaffe/kaffe/libraries/javalib/vmspecific/org/kaffe/lang/Attic/ResourceReader.java,v
VERS: 1.1
***************
--- kaffe/libraries/javalib/vmspecific/org/kaffe/lang/ResourceReader.java Sun Jul 16 23:43:25 2006
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,27 +0,0 @@
-package org.kaffe.lang;
-
-import java.io.InputStream;
-
-/**
- * This interface maps a fully qualified class name to an array of bytes.
- */
-public interface ResourceReader
-{
- /**
- * Read byte code.
- *
- * @param name fully qualified class name (using dots as separators
- * and no trailing .class suffix)
- * @return array of bytes in class file format
- */
- byte[] getByteCode(String name) throws Exception;
-
- /**
- * Read byte code.
- *
- * @param name name of the resource, leading slashes are ignored
- *
- * @return array of bytes of that resource
- */
- InputStream getResourceAsStream(String name) throws Exception;
-}
More information about the kaffe
mailing list