示例#1
0
    public String hasSameContent(JarFile2 file, JarEntry entry) throws IOException {

      String thisName = null;

      Long crcL = new Long(entry.getCrc());

      // check if this jar contains files with the passed in entry's crc
      if (_crcToEntryMap.containsKey(crcL)) {
        // get the Linked List with files with the crc
        LinkedList ll = (LinkedList) _crcToEntryMap.get(crcL);
        // go through the list and check for content match
        ListIterator li = ll.listIterator(0);
        if (li != null) {
          while (li.hasNext()) {
            JarEntry thisEntry = (JarEntry) li.next();

            // check for content match
            InputStream oldIS = getJarFile().getInputStream(thisEntry);
            InputStream newIS = file.getJarFile().getInputStream(entry);

            if (!differs(oldIS, newIS)) {
              thisName = thisEntry.getName();
              return thisName;
            }
          }
        }
      }

      return thisName;
    }