+ public void addlib(String clnm, byte[] contents) throws IOException {
+ if(!haslib) {
+ Files.createDirectory(libdir);
+ classpath(libdir);
+ haslib = true;
+ }
+ Path p = libdir;
+ int p1 = 0;
+ while(true) {
+ int p2 = clnm.indexOf('.', p1);
+ if(p2 < 0)
+ break;
+ p = p.resolve(clnm.substring(p1, p2));
+ if(!Files.isDirectory(p))
+ Files.createDirectory(p);
+ p1 = p2 + 1;
+ }
+ p = p.resolve(clnm.substring(p1) + ".class");
+ Files.write(p, contents);
+ }
+
+ public void addlib(Map<String, byte[]> classes) throws IOException {
+ for(Map.Entry<String, byte[]> ent : classes.entrySet())
+ addlib(ent.getKey(), ent.getValue());
+ }
+