@Override public int read(final byte[] buf, final int off, final int len) throws IOException { try { final int ret = in.read(buf, off, len); count(ret); return ret; } catch (org.tukaani.xz.MemoryLimitException e) { //convert to commons-compress MemoryLimtException throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), e); } }
@Override public int read() throws IOException { try { final int ret = in.read(); count(ret == -1 ? -1 : 1); return ret; } catch (org.tukaani.xz.MemoryLimitException e) { throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), e); } }
@Override public long skip(final long n) throws IOException { try { return IOUtils.skip(in, n); } catch (org.tukaani.xz.MemoryLimitException e) { //convert to commons-compress MemoryLimtException throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), e); } }
/** * Creates a new input stream that decompresses LZMA-compressed data * from the specified input stream. * * @param inputStream where to read the compressed data * * @param memoryLimitInKb calculated memory use threshold. Throws MemoryLimitException * if calculate memory use is above this threshold * * @throws IOException if the input is not in the .lzma format, * the input is corrupt or truncated, the .lzma * headers specify sizes that are not supported * by this implementation, or the underlying * <code>inputStream</code> throws an exception * * @since 1.14 */ public LZMACompressorInputStream(final InputStream inputStream, int memoryLimitInKb) throws IOException { try { in = new LZMAInputStream(countingStream = new CountingInputStream(inputStream), memoryLimitInKb); } catch (org.tukaani.xz.MemoryLimitException e) { //convert to commons-compress exception throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), e); } }
@Override public long skip(final long n) throws IOException { try { return in.skip(n); } catch (org.tukaani.xz.MemoryLimitException e) { //convert to commons-compress MemoryLimtException throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), e); } }
@Override public int read() throws IOException { try { final int ret = in.read(); count(ret == -1 ? -1 : 1); return ret; } catch (org.tukaani.xz.MemoryLimitException e) { throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), e); } }
@Override public int read(final byte[] buf, final int off, final int len) throws IOException { try { final int ret = in.read(buf, off, len); count(ret); return ret; } catch (org.tukaani.xz.MemoryLimitException e) { //convert to commons-compress MemoryLimtException throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), e); } }
/** * Creates a new input stream that decompresses LZMA-compressed data * from the specified input stream. * * @param inputStream where to read the compressed data * * @param memoryLimitInKb calculated memory use threshold. Throws MemoryLimitException * if calculate memory use is above this threshold * * @throws IOException if the input is not in the .lzma format, * the input is corrupt or truncated, the .lzma * headers specify sizes that are not supported * by this implementation, or the underlying * <code>inputStream</code> throws an exception * * @since 1.14 */ public LZMACompressorInputStream(final InputStream inputStream, int memoryLimitInKb) throws IOException { try { in = new LZMAInputStream(inputStream, memoryLimitInKb); } catch (org.tukaani.xz.MemoryLimitException e) { //convert to commons-compress exception throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), e); } }