org.apache.commons.compress.archivers.cpio.CpioArchiveOutputStream Java Examples

The following examples show how to use org.apache.commons.compress.archivers.cpio.CpioArchiveOutputStream. 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: Cpio.java    From gradle-plugins with MIT License 5 votes vote down vote up
@SneakyThrows
private WorkResult execute(CopyActionProcessingStream copyActionProcessingStream) {
    try (CpioArchiveOutputStream archiveOutputStream = new CpioArchiveOutputStream(
            new FileOutputStream(getArchiveFile().get().getAsFile()),
            format.get(),
            blockSize.get(),
            encoding.get()
    )) {
        copyActionProcessingStream.process(new StreamAction(archiveOutputStream, getFormat().get()));

        return WorkResults.didWork(true);
    }
}
 
Example #2
Source File: Cpio.java    From gradle-plugins with MIT License 5 votes vote down vote up
@SneakyThrows
private WorkResult execute(CopyActionProcessingStream copyActionProcessingStream) {
    try (CpioArchiveOutputStream archiveOutputStream = new CpioArchiveOutputStream(
            new FileOutputStream(getArchiveFile().get().getAsFile()),
            format.get(),
            blockSize.get(),
            encoding.get()
    )) {
        copyActionProcessingStream.process(new StreamAction(archiveOutputStream, getFormat().get()));

        return WorkResults.didWork(true);
    }
}
 
Example #3
Source File: PayloadRecorder.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
public PayloadRecorder ( final boolean autoFinish, final PayloadCoding payloadCoding, final String payloadFlags, final DigestAlgorithm fileDigestAlgorithm ) throws IOException
{
    this.autoFinish = autoFinish;

    this.fileDigestAlgorithm = fileDigestAlgorithm;

    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 );

        this.payloadCoding = payloadCoding;

        this.payloadFlags = Optional.ofNullable ( payloadFlags );

        final OutputStream payloadStream = this.payloadCoding.createProvider ().createOutputStream ( this.payloadCounter, this.payloadFlags );

        this.archiveCounter = new CountingOutputStream ( payloadStream );

        // setup archive stream

        this.archiveStream = new CpioArchiveOutputStream ( this.archiveCounter, CpioConstants.FORMAT_NEW, 4, CharsetNames.UTF_8 );
    }
    catch ( final IOException e )
    {
        Files.deleteIfExists ( this.tempFile );
        throw e;
    }
}