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


Java ArchiveStreamFactory.TAR屬性代碼示例

本文整理匯總了Java中org.apache.commons.compress.archivers.ArchiveStreamFactory.TAR屬性的典型用法代碼示例。如果您正苦於以下問題:Java ArchiveStreamFactory.TAR屬性的具體用法?Java ArchiveStreamFactory.TAR怎麽用?Java ArchiveStreamFactory.TAR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.commons.compress.archivers.ArchiveStreamFactory的用法示例。


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

示例1: testOpenForGeneratedArchives

@Test
public void testOpenForGeneratedArchives() throws Exception
{
    String[] testFormats = new String[]{
            ArchiveStreamFactory.AR,
            // ArchiveStreamFactory.ARJ, // ArchiveException: Archiver: arj not found.
            ArchiveStreamFactory.CPIO,
            // ArchiveStreamFactory.DUMP, // ArchiveException: Archiver: dump not found.
            ArchiveStreamFactory.JAR,
            // ArchiveStreamFactory.SEVEN_Z, // StreamingNotSupportedException: The 7z doesn't support streaming.
            ArchiveStreamFactory.TAR,
            ArchiveStreamFactory.ZIP,
    };

    for (String format : testFormats) {
        TaskSource mockTaskSource = new MockTaskSource(format);
        FileInput mockInput = new MockFileInput(
                getInputStreamAsBuffer(
                        getArchiveInputStream(format, "sample_1.csv", "sample_2.csv")));
        CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
        FileInput archiveFileInput = plugin.open(mockTaskSource, mockInput);
        verifyContents(archiveFileInput, "1,foo", "2,bar");
    }
}
 
開發者ID:hata,項目名稱:embulk-decoder-commons-compress,代碼行數:24,代碼來源:TestCommonsCompressDecoderPlugin.java

示例2: compressTar

@SuppressWarnings("resource")
private void compressTar(ByteArrayOutputStream out) throws IOException { 
	TarArchiveOutputStream wrapperOS = new TarArchiveOutputStream(out);
	TarArchiveEntry entry = new TarArchiveEntry(ArchiveStreamFactory.TAR);
	entry.setSize(data.length);
	wrapperOS.putArchiveEntry(entry);
	wrapperOS.write(data);
	wrapperOS.closeArchiveEntry();
}
 
開發者ID:android-workloads,項目名稱:JACWfA,代碼行數:9,代碼來源:Tar.java

示例3: testToFormatsForSingleFormat

@Test
public void testToFormatsForSingleFormat() {
    String format = ArchiveStreamFactory.TAR;
    String[] formats = CommonsCompressUtil.toFormats(format);
    assertEquals("a single format returns 1 length array.", 1, formats.length);
    assertEquals("a single format returns tar.", ArchiveStreamFactory.TAR, formats[0]);
}
 
開發者ID:hata,項目名稱:embulk-decoder-commons-compress,代碼行數:7,代碼來源:TestCommonsCompressUtil.java

示例4: testToFormatsForMultipleFormats

@Test
public void testToFormatsForMultipleFormats() {
    String format = ArchiveStreamFactory.TAR + " " + CompressorStreamFactory.BZIP2;
    String[] formats = CommonsCompressUtil.toFormats(format);
    assertEquals("Two format text returns 2 length array.", 2, formats.length);
    assertEquals("Two format text returns bzip2 for 1st element.", CompressorStreamFactory.BZIP2, formats[0]);
    assertEquals("Two format text returns tar for 1st element.", ArchiveStreamFactory.TAR, formats[1]);
}
 
開發者ID:hata,項目名稱:embulk-decoder-commons-compress,代碼行數:8,代碼來源:TestCommonsCompressUtil.java

示例5: TarLzma

/**
 * Constructs a new instance of this class using the TAR constant of
 * {@link ArchiveStreamFactory} and the LZMA constant of
 * {@link CompressorStreamFactory}.
 */
public TarLzma() {
    super(ArchiveStreamFactory.TAR, CompressorStreamFactory.LZMA);
}
 
開發者ID:turbolocust,項目名稱:GZipper,代碼行數:8,代碼來源:TarLzma.java

示例6: Tarball

/**
 * Constructs a new instance of this class using the TAR constant of
 * {@link ArchiveStreamFactory} and the GZIP constant of
 * {@link CompressorStreamFactory}.
 */
public Tarball() {
    super(ArchiveStreamFactory.TAR, CompressorStreamFactory.GZIP);
}
 
開發者ID:turbolocust,項目名稱:GZipper,代碼行數:8,代碼來源:Tarball.java

示例7: TarBzip2

/**
 * Constructs a new instance of this class using the TAR constant of
 * {@link ArchiveStreamFactory} and the BZIP2 constant of
 * {@link CompressorStreamFactory}.
 */
public TarBzip2() {
    super(ArchiveStreamFactory.TAR, CompressorStreamFactory.BZIP2);
}
 
開發者ID:turbolocust,項目名稱:GZipper,代碼行數:8,代碼來源:TarBzip2.java


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