+ /*public synchronized void clearCache() {
+ cache.clear();
+ }
+
+ public synchronized Class getCachedClass(String key, long timeStamp) {
+ String name = "nestedvm." + Base64.encode(key);
+ CacheEnt ent = (CacheEnt) cache.get(name);
+ if(ent.timeStamp < timeStamp) {
+ cache.remove(key);
+ return null;
+ }
+ return ent.klass;
+ }
+
+ public synchronized Class createClass(String key, long timeStamp, Seekable data) {
+ Class klass = getCachedClass(key,timeStamp);
+ if(klass != null) return klass;
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ new ClassFileCompiler(data,name,bos).go();
+ bos.close();
+ byte[] buf = bos.toByteArray();
+ klass = defineClass(name,buf,0,buf.length);
+ resolveClass(klass);
+ cache.put(key,new CacheEnt(klass,timeStamp));
+ return klass;
+ } catch(Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private class CacheEnt {
+ public CacheEnt(Class klass, long timeStamp) { this.klass = klass; this.timeStamp = timeStamp; }
+ public Class klass;
+ public long timeStamp;
+ }*/
+
+ /*public Class classFromBinary(String path) throws ClassNotFoundException {