Java Code Examples for org.apache.tools.zip.ZipEntry#setUnixMode()
The following examples show how to use
org.apache.tools.zip.ZipEntry#setUnixMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Files.java From development with Apache License 2.0 | 6 votes |
public void writeTo(OutputStream out) throws IOException { final Set<String> filenames = new HashSet<String>(); final ZipOutputStream zipout = new ZipOutputStream(out); for (IFile f : container.getFiles()) { assertNoAbsolutePath(f); assertNoDuplicates(filenames, f); ZipEntry entry = new ZipEntry(f.getLocalPath()); entry.setTime(f.getLastModified()); if (f.getPermissions() != IFile.UNDEF_PERMISSIONS) { entry.setUnixMode(f.getPermissions()); } zipout.putNextEntry(entry); f.writeTo(zipout); zipout.closeEntry(); } zipout.finish(); }
Example 2
Source File: ZipCopyAction.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void visitFile(FileCopyDetails fileDetails) { try { ZipEntry archiveEntry = new ZipEntry(fileDetails.getRelativePath().getPathString()); archiveEntry.setTime(fileDetails.getLastModified()); archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode()); zipOutStr.putNextEntry(archiveEntry); fileDetails.copyTo(zipOutStr); zipOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e); } }
Example 3
Source File: ZipCopyAction.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void visitDir(FileCopyDetails dirDetails) { try { // Trailing slash in name indicates that entry is a directory ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/'); archiveEntry.setTime(dirDetails.getLastModified()); archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode()); zipOutStr.putNextEntry(archiveEntry); zipOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e); } }
Example 4
Source File: ZipCopyAction.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void visitFile(FileCopyDetails fileDetails) { try { ZipEntry archiveEntry = new ZipEntry(fileDetails.getRelativePath().getPathString()); archiveEntry.setTime(fileDetails.getLastModified()); archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode()); zipOutStr.putNextEntry(archiveEntry); fileDetails.copyTo(zipOutStr); zipOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e); } }
Example 5
Source File: ZipCopyAction.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void visitDir(FileCopyDetails dirDetails) { try { // Trailing slash in name indicates that entry is a directory ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/'); archiveEntry.setTime(dirDetails.getLastModified()); archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode()); zipOutStr.putNextEntry(archiveEntry); zipOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e); } }
Example 6
Source File: ZipCopyAction.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void visitFile(FileCopyDetails fileDetails) { try { ZipEntry archiveEntry = new ZipEntry(fileDetails.getRelativePath().getPathString()); archiveEntry.setTime(fileDetails.getLastModified()); archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode()); zipOutStr.putNextEntry(archiveEntry); fileDetails.copyTo(zipOutStr); zipOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e); } }
Example 7
Source File: ZipCopyAction.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void visitDir(FileCopyDetails dirDetails) { try { // Trailing slash in name indicates that entry is a directory ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/'); archiveEntry.setTime(dirDetails.getLastModified()); archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode()); zipOutStr.putNextEntry(archiveEntry); zipOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e); } }
Example 8
Source File: ZipCopyAction.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void visitFile(FileCopyDetails fileDetails) { try { ZipEntry archiveEntry = new ZipEntry(fileDetails.getRelativePath().getPathString()); archiveEntry.setTime(fileDetails.getLastModified()); archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode()); zipOutStr.putNextEntry(archiveEntry); fileDetails.copyTo(zipOutStr); zipOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e); } }
Example 9
Source File: ZipCopyAction.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void visitDir(FileCopyDetails dirDetails) { try { // Trailing slash in name indicates that entry is a directory ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/'); archiveEntry.setTime(dirDetails.getLastModified()); archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode()); zipOutStr.putNextEntry(archiveEntry); zipOutStr.closeEntry(); } catch (Exception e) { throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e); } }