示例#1
0
 private void processMetaInfEntry(AsciiBytes name, JarEntryData entry) {
   if (name.equals(MANIFEST_MF)) {
     this.manifestEntry = entry;
   }
   if (name.endsWith(SIGNATURE_FILE_EXTENSION)) {
     this.signed = true;
   }
 }
示例#2
0
 private JarFile createJarFileFromDirectoryEntry(JarEntryData sourceEntry) throws IOException {
   final AsciiBytes sourceName = sourceEntry.getName();
   JarEntryFilter filter =
       new JarEntryFilter() {
         @Override
         public AsciiBytes apply(AsciiBytes name, JarEntryData entryData) {
           if (name.startsWith(sourceName) && !name.equals(sourceName)) {
             return name.substring(sourceName.length());
           }
           return null;
         }
       };
   return new JarFile(
       this.rootFile,
       this.pathFromRoot + "!/" + sourceEntry.getName().substring(0, sourceName.length() - 1),
       this.data,
       this.entries,
       filter);
 }
示例#3
0
  public JarEntryData getJarEntryData(AsciiBytes name) {
    if (name == null) {
      return null;
    }
    Map<AsciiBytes, JarEntryData> entriesByName =
        (this.entriesByName == null ? null : this.entriesByName.get());
    if (entriesByName == null) {
      entriesByName = new HashMap<AsciiBytes, JarEntryData>();
      for (JarEntryData entry : this.entries) {
        entriesByName.put(entry.getName(), entry);
      }
      this.entriesByName = new SoftReference<Map<AsciiBytes, JarEntryData>>(entriesByName);
    }

    JarEntryData entryData = entriesByName.get(name);
    if (entryData == null && !name.endsWith(SLASH)) {
      entryData = entriesByName.get(name.append(SLASH));
    }
    return entryData;
  }
示例#4
0
 private void processEntry(JarEntryData entry) {
   AsciiBytes name = entry.getName();
   if (name.startsWith(META_INF)) {
     processMetaInfEntry(name, entry);
   }
 }