Example usage for org.apache.commons.compress.compressors.xz XZCompressorInputStream XZCompressorInputStream

List of usage examples for org.apache.commons.compress.compressors.xz XZCompressorInputStream XZCompressorInputStream

Introduction

In this page you can find the example usage for org.apache.commons.compress.compressors.xz XZCompressorInputStream XZCompressorInputStream.

Prototype

public XZCompressorInputStream(InputStream inputStream, boolean decompressConcatenated,
        final int memoryLimitInKb) throws IOException 

Source Link

Document

Creates a new input stream that decompresses XZ-compressed data from the specified input stream.

Usage

From source file:net.yacy.document.parser.XZParser.java

@Override
protected CompressorInputStream createDecompressStream(final InputStream source) throws IOException {
    /*//from w  w w  .j a  v  a2 s.c  o m
     * Limit the size dedicated to reading compressed blocks to at most 25% of the
     * available memory. Eventual stricter limits should be handled by the caller
     * (see for example crawler.[protocol].maxFileSize configuration setting).
     */
    final long availableMemory = MemoryControl.available();
    final long maxKBytes = (long) (availableMemory * 0.25 / 1024.0);
    return new XZCompressorInputStream(source, false, (int) Math.min(Integer.MAX_VALUE, maxKBytes));
}