當前位置: 首頁>>代碼示例>>Java>>正文


Java UnixStat類代碼示例

本文整理匯總了Java中org.apache.tools.zip.UnixStat的典型用法代碼示例。如果您正苦於以下問題:Java UnixStat類的具體用法?Java UnixStat怎麽用?Java UnixStat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UnixStat類屬於org.apache.tools.zip包,在下文中一共展示了UnixStat類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getUnixMode

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
/**
 * Determine a Resource's Unix mode or return the given default
 * value if not available.
 */
private int getUnixMode(final Resource r, final ZipFile zf, final int defaultMode) {

    int unixMode = defaultMode;
    if (zf != null) {
        final ZipEntry ze = zf.getEntry(r.getName());
        unixMode = ze.getUnixMode();
        if ((unixMode == 0 || unixMode == UnixStat.DIR_FLAG)
            && !preserve0Permissions) {
            unixMode = defaultMode;
        }
    } else if (r instanceof ArchiveResource) {
        unixMode = ((ArchiveResource) r).getMode();
    }
    return unixMode;
}
 
開發者ID:apache,項目名稱:ant,代碼行數:20,代碼來源:Zip.java

示例2: packMetadata

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
private void packMetadata(TaskOutputOriginWriter writeMetadata, TarOutputStream outputStream) throws IOException {
    TarEntry entry = new TarEntry(METADATA_PATH);
    entry.setMode(UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    writeMetadata.execute(baos);
    entry.setSize(baos.size());
    outputStream.putNextEntry(entry);
    try {
        outputStream.write(baos.toByteArray());
    } finally {
        outputStream.closeEntry();
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:14,代碼來源:TarTaskOutputPacker.java

示例3: storeDirectoryEntry

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
private void storeDirectoryEntry(FileVisitDetails dirDetails, String propertyRoot, TarOutputStream outputStream) throws IOException {
    String path = dirDetails.getRelativePath().getPathString();
    TarEntry entry = new TarEntry(propertyRoot + path + "/");
    storeModificationTime(entry, dirDetails.getLastModified());
    entry.setMode(UnixStat.DIR_FLAG | dirDetails.getMode());
    outputStream.putNextEntry(entry);
    outputStream.closeEntry();
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:9,代碼來源:TarTaskOutputPacker.java

示例4: storeFileEntry

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
private void storeFileEntry(File file, String path, long lastModified, long size, int mode, TarOutputStream outputStream) throws IOException {
    TarEntry entry = new TarEntry(path);
    storeModificationTime(entry, lastModified);
    entry.setSize(size);
    entry.setMode(UnixStat.FILE_FLAG | mode);
    outputStream.putNextEntry(entry);
    try {
        Files.copy(file, outputStream);
    } finally {
        outputStream.closeEntry();
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:TarTaskOutputPacker.java

示例5: visitFile

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
private void visitFile(FileCopyDetails fileDetails) {
    try {
        TarEntry archiveEntry = new TarEntry(fileDetails.getRelativePath().getPathString());
        archiveEntry.setModTime(fileDetails.getLastModified());
        archiveEntry.setSize(fileDetails.getSize());
        archiveEntry.setMode(UnixStat.FILE_FLAG | fileDetails.getMode());
        tarOutStr.putNextEntry(archiveEntry);
        fileDetails.copyTo(tarOutStr);
        tarOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to TAR '%s'.", fileDetails, tarFile), e);
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:14,代碼來源:TarCopyAction.java

示例6: visitDir

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
private void visitDir(FileCopyDetails dirDetails) {
    try {
        // Trailing slash on name indicates entry is a directory
        TarEntry archiveEntry = new TarEntry(dirDetails.getRelativePath().getPathString() + '/');
        archiveEntry.setModTime(dirDetails.getLastModified());
        archiveEntry.setMode(UnixStat.DIR_FLAG | dirDetails.getMode());
        tarOutStr.putNextEntry(archiveEntry);
        tarOutStr.closeEntry();
    } catch (Exception e) {
        throw new GradleException(String.format("Could not add %s to TAR '%s'.", dirDetails, tarFile), e);
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:TarCopyAction.java

示例7: visitFile

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
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);
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:ZipCopyAction.java

示例8: visitDir

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
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);
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:ZipCopyAction.java

示例9: testTarFileSet

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
@Test
public void testTarFileSet() throws IOException {
   buildRule.executeTarget("testTarFileSet");
    org.apache.tools.zip.ZipFile zf = null;
    try {
        zf = new org.apache.tools.zip.ZipFile(new File(buildRule.getProject().getProperty("output"), "test3.zip"));
        org.apache.tools.zip.ZipEntry ze = zf.getEntry("asf-logo.gif");
        assertEquals(UnixStat.FILE_FLAG | 0446, ze.getUnixMode());
    } finally {
        if (zf != null) {
            zf.close();
        }
    }
}
 
開發者ID:apache,項目名稱:ant,代碼行數:15,代碼來源:ZipTest.java

示例10: testRewriteZeroPermissions

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
@Test
public void testRewriteZeroPermissions() throws IOException {
   buildRule.executeTarget("rewriteZeroPermissions");
    org.apache.tools.zip.ZipFile zf = null;
    try {
        zf = new org.apache.tools.zip.ZipFile(new File(buildRule.getProject().getProperty("output"), "test3.zip"));
        org.apache.tools.zip.ZipEntry ze = zf.getEntry("testdir/test.txt");
        assertEquals(UnixStat.FILE_FLAG | 0644, ze.getUnixMode());
    } finally {
        if (zf != null) {
            zf.close();
        }
    }
}
 
開發者ID:apache,項目名稱:ant,代碼行數:15,代碼來源:ZipTest.java

示例11: testForBugzilla34764

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
@Test
public void testForBugzilla34764() throws IOException {
   buildRule.executeTarget("testForBugzilla34764");
    org.apache.tools.zip.ZipFile zf = null;
    try {
        zf = new org.apache.tools.zip.ZipFile(new File(buildRule.getProject().getProperty("output"), "test3.zip"));
        org.apache.tools.zip.ZipEntry ze = zf.getEntry("file1");
        assertEquals(UnixStat.FILE_FLAG | 0644, ze.getUnixMode());
    } finally {
        if (zf != null) {
            zf.close();
        }
    }
}
 
開發者ID:apache,項目名稱:ant,代碼行數:15,代碼來源:ZipTest.java

示例12: integerSetFileMode

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
/**
 * specify the user, group and
 * other modes in the standard Unix fashion;
 * optional, default=0644
 *
 * <p>We use the strange name so this method doesn't appear in
 * IntrospectionHelpers list of attribute setters.</p>
 * @param mode a <code>int</code> value
 * @since Ant 1.7
 */
public void integerSetFileMode(int mode) {
    fileModeHasBeenSet = true;
    this.fileMode = UnixStat.FILE_FLAG | mode;
}
 
開發者ID:apache,項目名稱:ant,代碼行數:15,代碼來源:ArchiveFileSet.java

示例13: integerSetDirMode

import org.apache.tools.zip.UnixStat; //導入依賴的package包/類
/**
 * specify the user, group and
 * other modes in the standard Unix fashion;
 * optional, default=0755
 * <p>We use the strange name so this method doesn't appear in
 * IntrospectionHelpers list of attribute setters.</p>
 * @param mode a <code>int</code> value
 * @since Ant 1.7
 */
public void integerSetDirMode(int mode) {
    dirModeHasBeenSet = true;
    this.dirMode = UnixStat.DIR_FLAG | mode;
}
 
開發者ID:apache,項目名稱:ant,代碼行數:14,代碼來源:ArchiveFileSet.java


注:本文中的org.apache.tools.zip.UnixStat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。