private static void add()

in lib/prolog/java/PrologCompiler.java [60:85]


  private static void add(JarOutputStream out, File classes, String prefix) throws IOException {
    String[] list = classes.list();
    if (list == null) {
      return;
    }
    for (String name : list) {
      File f = new File(classes, name);
      if (f.isDirectory()) {
        add(out, f, prefix + name + "/");
        continue;
      }

      JarEntry e = new JarEntry(prefix + name);
      try (InputStream in = Files.newInputStream(f.toPath())) {
        e.setTime(f.lastModified());
        out.putNextEntry(e);
        byte[] buf = new byte[16 << 10];
        int n;
        while (0 < (n = in.read(buf))) {
          out.write(buf, 0, n);
        }
      } finally {
        out.closeEntry();
      }
    }
  }