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


Java CpioArchiveOutputStream類代碼示例

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


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

示例1: PayloadRecorder

import org.apache.commons.compress.archivers.cpio.CpioArchiveOutputStream; //導入依賴的package包/類
public PayloadRecorder ( final boolean autoFinish ) throws IOException
{
    this.autoFinish = autoFinish;

    this.tempFile = Files.createTempFile ( "rpm-", null );

    try
    {
        this.fileStream = new BufferedOutputStream ( Files.newOutputStream ( this.tempFile, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING ) );

        this.payloadCounter = new CountingOutputStream ( this.fileStream );

        final GZIPOutputStream payloadStream = new GZIPOutputStream ( this.payloadCounter );
        this.archiveCounter = new CountingOutputStream ( payloadStream );

        // setup archive stream

        this.archiveStream = new CpioArchiveOutputStream ( this.archiveCounter, CpioConstants.FORMAT_NEW, 4, "UTF-8" );
    }
    catch ( final IOException e )
    {
        Files.deleteIfExists ( this.tempFile );
        throw e;
    }
}
 
開發者ID:eclipse,項目名稱:packagedrone,代碼行數:26,代碼來源:PayloadRecorder.java

示例2: compressData

import org.apache.commons.compress.archivers.cpio.CpioArchiveOutputStream; //導入依賴的package包/類
/**
 * Compress data
 * 
 * @param fileCompressor
 *            FileCompressor object
 * @return
 * @throws Exception
 */
@Override
public byte[] compressData(FileCompressor fileCompressor) throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    CpioArchiveOutputStream aos = new CpioArchiveOutputStream(baos);
    try {
        for (BinaryFile binaryFile : fileCompressor.getMapBinaryFile()
                .values()) {
            CpioArchiveEntry entry = new CpioArchiveEntry(
                    binaryFile.getDesPath(), binaryFile.getActualSize());
            aos.putArchiveEntry(entry);
            aos.write(binaryFile.getData());
            aos.closeArchiveEntry();
        }
        aos.flush();
        aos.finish();
    } catch (Exception e) {
        FileCompressor.LOGGER.error("Error on compress data", e);
    } finally {
        aos.close();
        baos.close();
    }
    return baos.toByteArray();
}
 
開發者ID:espringtran,項目名稱:compressor4j,代碼行數:32,代碼來源:CpioProcessor.java

示例3: createArchiveOutputStream

import org.apache.commons.compress.archivers.cpio.CpioArchiveOutputStream; //導入依賴的package包/類
ArchiveOutputStream createArchiveOutputStream() throws IOException {
    switch (format) {
    case CPIO:
        return new CpioArchiveOutputStream(output);
    case JAR:
        return new JarArchiveOutputStream(output);
    case TAR:
        return new TarArchiveOutputStream(output);
    case ZIP:
        return new ZipArchiveOutputStream(output);
    }

    // Normally, this code is not called because of the above switch.
    throw new IOException("Format is configured.");
}
 
開發者ID:hata,項目名稱:embulk-encoder-commons-compress,代碼行數:16,代碼來源:CommonsCompressArchiveProvider.java


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