C
Christian Schlichtherle
Hi,
I have written a substitute for some java.io.* classes. My classes treat ZIP
or JAR files exactly like directories, so that you can e.g. list ZIP files
and arbitrarily read or write or delete their entries. My substitutes have
the same name as in the java.io package, but live in their own package (e.g.
de.schlichtherle.io.File instead of java.io.File). This provides 98% source
code compatibility - most of the time a simple import statement at the top
of a using class is enough to use the new functionality.
To achieve 100% compatibility I would like to provide a modified classloader
which loads my classes instead of the java.io.* classes. This is not a
problem, as their is enough documentation on how to do it (basically you
only need to override the loadClass(...) method). However, my classes
delegate to the original java.io.* classes when e.g. encountering ordinary
files.
So how can I make an application using my classes as java.io.* when at the
same time my classes need to delegate to the original java.io.* classes???
Any hints would be helpful.
With best regards,
Christian
I have written a substitute for some java.io.* classes. My classes treat ZIP
or JAR files exactly like directories, so that you can e.g. list ZIP files
and arbitrarily read or write or delete their entries. My substitutes have
the same name as in the java.io package, but live in their own package (e.g.
de.schlichtherle.io.File instead of java.io.File). This provides 98% source
code compatibility - most of the time a simple import statement at the top
of a using class is enough to use the new functionality.
To achieve 100% compatibility I would like to provide a modified classloader
which loads my classes instead of the java.io.* classes. This is not a
problem, as their is enough documentation on how to do it (basically you
only need to override the loadClass(...) method). However, my classes
delegate to the original java.io.* classes when e.g. encountering ordinary
files.
So how can I make an application using my classes as java.io.* when at the
same time my classes need to delegate to the original java.io.* classes???
Any hints would be helpful.
With best regards,
Christian