This is unlikely, as you will find if you try to do it yourself. You won't be able to randomly access an InputStream
to look up classes as they're requested, so you'll have to cache the contents either in memory or in the file system.
If you cache on disk, just use URLClassLoader.
If you cache in memory, you'll need to create some sort of Map
with JarInputStream and then extend ClassLoader
(overriding the appropriate methods). The downside of this approach is that you keep data in RAM unnecessarily.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…