Ejemplo n.º 1
0
  public void write(OutputStream out) throws IOException {
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out, "UTF8"));

    bw.write("JarIndex-Version: 1.0\n\n");

    if (jarFiles != null) {
      for (String jar : jarFiles) {
        bw.write(jar + "\n");

        LinkedList<String> jarlist = jarMap.get(jar);

        if (jarlist != null) {
          Iterator<String> listitr = jarlist.iterator();

          while (listitr.hasNext()) {
            bw.write(listitr.next() + "\n");
          }
        }

        bw.write("\n");
      }

      bw.flush();
    }
  }
Ejemplo n.º 2
0
  public void merge(JarIndex toIndex, String path) {
    Iterator<Map.Entry<String, LinkedList<String>>> itr = indexMap.entrySet().iterator();

    while (itr.hasNext()) {
      Map.Entry<String, LinkedList<String>> e = itr.next();

      String packageName = e.getKey();

      LinkedList<String> from_list = e.getValue();

      Iterator<String> listItr = from_list.iterator();

      while (listItr.hasNext()) {
        String jarName = listItr.next();

        if (path != null) {
          jarName = path.concat(jarName);
        }

        toIndex.addMapping(packageName, jarName);
      }
    }
  }