예제 #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();
    }
  }
예제 #2
0
  private void addToList(String key, String value, HashMap<String, LinkedList<String>> t) {
    LinkedList<String> list = t.get(key);

    if (list == null) {
      list = new LinkedList<>();

      list.add(value);

      t.put(key, list);
    } else if (!list.contains(value)) {
      list.add(value);
    }
  }
예제 #3
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);
      }
    }
  }