use of com.mucommander.commons.io.FilteredOutputStream in project mucommander by mucommander.
the class ZipArchiveFile method addEntry.
// ////////////////////////////////////////
// AbstractRWArchiveFile implementation //
// ////////////////////////////////////////
@Override
public synchronized OutputStream addEntry(final ArchiveEntry entry) throws IOException, UnsupportedFileOperationException {
checkZipFile();
final ZipEntry zipEntry = createZipEntry(entry);
if (zipEntry.isDirectory()) {
// Add the new directory entry to the zip file (physically)
zipFile.addEntry(zipEntry);
// Set the ZipEntry object into the ArchiveEntry
entry.setEntryObject(zipEntry);
// Declare the zip file and entries tree up-to-date and add the new entry to the entries tree
finishAddEntry(entry);
return null;
} else {
// Set the ZipEntry object into the ArchiveEntry
entry.setEntryObject(zipEntry);
return new FilteredOutputStream(zipFile.addEntry(zipEntry)) {
@Override
public void close() throws IOException {
super.close();
// Declare the zip file and entries tree up-to-date and add the new entry to the entries tree
finishAddEntry(entry);
}
};
}
}
Aggregations