org.apache.commons.compress.compressors.xz.XZCompressorOutputStream Java Examples

The following examples show how to use org.apache.commons.compress.compressors.xz.XZCompressorOutputStream. 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: XZPayloadCoding.java    From packagedrone with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public OutputStream createOutputStream ( final OutputStream out, final Optional<String> optionalFlags ) throws IOException
{
    final String flags;
    final int preset;

    if ( optionalFlags.isPresent () && ( flags = optionalFlags.get () ).length () > 0 )
    {
        preset = Integer.parseInt ( flags.substring ( 0, 1 ) );
    }
    else
    {
        preset = LZMA2Options.PRESET_DEFAULT;
    }

    return new XZCompressorOutputStream ( out, preset );
}