use of com.mucommander.commons.file.archive.zip.provider.ZipEntry in project mucommander by mucommander.
the class ZipArchiveFile method deleteEntry.
@Override
public synchronized void deleteEntry(ArchiveEntry entry) throws IOException, UnsupportedFileOperationException {
ZipEntry zipEntry = (com.mucommander.commons.file.archive.zip.provider.ZipEntry) entry.getEntryObject();
// That is the case when a file entry exists in the Zip file but has no directory entry for the parent.
if (zipEntry != null) {
// Entry exists physically in the zip file
checkZipFile();
// Delete the entry from the zip file (physically)
zipFile.deleteEntry(zipEntry);
// Remove the ZipEntry object from the AchiveEntry
entry.setEntryObject(null);
// Declare the zip file and entries tree up-to-date
declareZipFileUpToDate();
declareEntriesTreeUpToDate();
}
// Else entry doesn't physically exist in the zip file, only in the entries tree
// Remove the entry from the entries tree
removeFromEntriesTree(entry);
}
use of com.mucommander.commons.file.archive.zip.provider.ZipEntry in project mucommander by mucommander.
the class ZipArchiveFile method createZipEntry.
/**
* Creates and returns a {@link com.mucommander.commons.file.archive.zip.provider.ZipEntry} instance using the attributes
* of the given {@link ArchiveEntry}.
*
* @param entry the object that serves to initialize the attributes of the returned ZipEntry
* @return a ZipEntry whose attributes are fetched from the given ZipEntry
*/
private ZipEntry createZipEntry(ArchiveEntry entry) {
boolean isDirectory = entry.isDirectory();
String path = entry.getPath();
if (isDirectory && !path.endsWith("/"))
path += "/";
com.mucommander.commons.file.archive.zip.provider.ZipEntry zipEntry = new com.mucommander.commons.file.archive.zip.provider.ZipEntry(path);
zipEntry.setMethod(ZipConstants.DEFLATED);
zipEntry.setTime(System.currentTimeMillis());
zipEntry.setUnixMode(SimpleFilePermissions.padPermissions(entry.getPermissions(), isDirectory ? FilePermissions.DEFAULT_DIRECTORY_PERMISSIONS : FilePermissions.DEFAULT_FILE_PERMISSIONS).getIntValue());
return zipEntry;
}
Aggregations