byte[] getReadPassword(boolean invalid) throws ZipKeyException { return param.getReadPassword(entry.getName(), invalid); } }
AesKeyStrength getKeyStrength() throws ZipKeyException { return param.getKeyStrength(entry.getName()); }
void setKeyStrength(AesKeyStrength keyStrength) throws ZipKeyException { param.setKeyStrength(entry.getName(), keyStrength); }
byte[] getWritePassword() throws ZipKeyException { return param.getWritePassword(entry.getName()); }
/** * Equivalent to {@link #getInputStream(String, Boolean, boolean) * getInputStream(entry.getName(), null, true)} instead. */ @CreatesObligation public final @Nullable InputStream getInputStream(ZipEntry entry) throws IOException { return getInputStream(entry.getName(), null, true); }
/** * Equivalent to {@link #getInputStream(String, Boolean, boolean) * getInputStream(entry.getName(), true, true)} instead. */ @CreatesObligation public final @Nullable InputStream getCheckedInputStream(ZipEntry entry) throws IOException { return getInputStream(entry.getName(), true, true); }
public List<String> getEntries( EntryNameFilter filter ) { ArrayList<String> entries = new ArrayList<String>(); Enumeration<? extends ZipEntry> en = getZipFile().entries(); while ( en.hasMoreElements() ) { final ZipEntry e = en.nextElement(); final String name = e.getName(); if ( filter != null && !filter.accepts( name ) ) { continue; } entries.add( name ); } return entries; }
public List<String> getEntries( EntryNameFilter filter ) { ArrayList<String> entries = new ArrayList<String>(); Enumeration<? extends ZipEntry> en = getZipFile().entries(); while ( en.hasMoreElements() ) { final ZipEntry e = en.nextElement(); final String name = e.getName(); if ( filter != null && !filter.accepts( name ) ) { continue; } entries.add( name ); } return entries; }
public List<String> getEntries( EntryNameFilter filter ) { ArrayList<String> entries = new ArrayList<String>(); Enumeration<? extends ZipEntry> en = getZipFile().entries(); while ( en.hasMoreElements() ) { final ZipEntry e = en.nextElement(); final String name = e.getName(); if ( filter != null && !filter.accepts( name ) ) { continue; } entries.add( name ); } return entries; }
@Override protected void handleEntry(ZipEntry entry) throws IOException { String entryName = entry.getName(); final String prefixPath = FilenameUtils.getPath(entryName); ResourceId correlationId = parentId; // by default, files are correlated to the parent. // If there is a path, get the actual correlation id for its parent folder: if (!prefixPath.isEmpty()) { correlationId = directories.get(prefixPath); // If we haven't seen the path before, add the ancestor folders not yet seen: if (correlationId == null) { correlationId = processAncestorFolders(prefixPath); } } // If there is a file, submit the file: entryName = FilenameUtils.getName(entryName); if (!entryName.isEmpty()) { submit(entry, entryName, parentName, zipFile, correlationId, originatorNodeId); } } }
@Override protected void handleEntry(ZipEntry entry) throws IOException { String entryName = entry.getName(); final String prefixPath = FilenameUtils.getPath(entryName); ResourceId correlationId = parentId; // by default, files are correlated to the parent. // If there is a path, get the actual correlation id for its parent folder: if (!prefixPath.isEmpty()) { correlationId = directories.get(prefixPath); // If we haven't seen the path before, add the ancestor folders not yet seen: if (correlationId == null) { correlationId = processAncestorFolders(prefixPath); } } // If there is a file, submit the file: entryName = FilenameUtils.getName(entryName); if (!entryName.isEmpty()) { submit(entry, entryName, parentName, zipFile, correlationId, originatorNodeId); } } }
final StringBuilder s = new StringBuilder(256); final Formatter f = new Formatter(s) .format("%s[name=%s", getClass().getName(), getName()); long value; if (UNKNOWN != (value = getGeneralPurposeBitFlags()))
@Override public void close() throws IOException { if (!closed) { while (skip(Long.MAX_VALUE) > 0) { // process CRC-32 until EOF } } super.close(); closed = true; final long expected = entry.getCrc(); final long computed = getChecksum().getValue(); if (expected != computed) throw new CRC32Exception(entry.getName(), expected, computed); } }
this.entries.put(entry.getName(), entry); this.entry = entry;
/** * Authenticates all encrypted data in this read only file. * It is safe to call this method multiple times to detect if the file * has been tampered with meanwhile. * * @throws ZipAuthenticationException If the computed MAC does not match * the MAC declared in the WinZip AES entry. * @throws IOException On any I/O related issue. */ void authenticate() throws IOException { final Mac mac = new HMac(new SHA1Digest()); mac.init(sha1MacParam); final byte[] buf = computeMac(mac); if (!ArrayHelper.equals(buf, 0, authenticationCode, 0, authenticationCode.length)) throw new ZipAuthenticationException(entry.getName() + " (authenticated WinZip AES entry content has been tampered with)"); } }
/** * @param parentName * @param entry * @param entryName * @param correlationId * @return */ private ResourceId submitDirectory(final URI parentName, ZipEntry entry, String entryName, ResourceId correlationId) { IdentificationResultImpl result = new IdentificationResultImpl(); long size = entry.getSize(); long time = entry.getTime(); RequestMetaData metaData = new RequestMetaData( size != -1 ? size : null, time != -1 ? time : null, entryName); RequestIdentifier identifier = new RequestIdentifier( ArchiveFileUtils.toZipUri(parentName, entry.getName())); result.setRequestMetaData(metaData); result.setIdentifier(identifier); return resultHandler.handleDirectory(result, correlationId, false); }
entryName); RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toZipUri(parentName, entry.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId);
/** * @param parentName * @param entry * @param entryName * @param correlationId * @return */ private ResourceId submitDirectory(final URI parentName, ZipEntry entry, String entryName, ResourceId correlationId) { IdentificationResultImpl result = new IdentificationResultImpl(); long size = entry.getSize(); long time = entry.getTime(); RequestMetaData metaData = new RequestMetaData( size != -1 ? size : null, time != -1 ? time : null, entryName); RequestIdentifier identifier = new RequestIdentifier( ArchiveFileUtils.toZipUri(parentName, entry.getName())); result.setRequestMetaData(metaData); result.setIdentifier(identifier); return resultHandler.handleDirectory(result, correlationId, false); }
entryName); RequestIdentifier identifier = new RequestIdentifier(ArchiveFileUtils.toZipUri(parentName, entry.getName())); identifier.setAncestorId(originatorNodeId); identifier.setParentResourceId(correlationId);
assertTrue(set.remove(entry.getName()));