当前位置: 首页>>代码示例>>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;未经允许,请勿转载。