@Override public int read(final byte[] buffer) throws IOException { return read(buffer, 0, buffer.length); }
@Override public int read() throws IOException { if (!readyBuffer()) { return -1; } return _encodedBytes[_bufferPosition++] & 255; }
@Override public void close() throws IOException { _bufferPosition = _bufferLength = 0; byte[] buf = _encodedBytes; if (buf != null) { _encodedBytes = null; _recycler.releaseEncodeBuffer(buf); } if (_encoder != null) { _encoder.close(); } _closeInput(); }
public byte[] uncompressStream(byte[] target) { byte[] bytes = null; InputStream uncompressedStream = null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ByteArrayInputStream bais = new ByteArrayInputStream(target); uncompressedStream = new LZFCompressingInputStream(bais); int num = -1; byte[] buf = new byte[1024]; baos = new ByteArrayOutputStream(); while ((num = uncompressedStream.read(buf, 0, buf.length)) != -1) { baos.write(bytes, 0, num); } return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } finally { try { if (uncompressedStream != null) { uncompressedStream.close(); } baos.close(); } catch (IOException e) { } } }
@Override public void close() throws IOException { _bufferPosition = _bufferLength = 0; byte[] buf = _encodedBytes; if (buf != null) { _encodedBytes = null; _recycler.releaseEncodeBuffer(buf); } if (_encoder != null) { _encoder.close(); } _closeInput(); }
@Override public int read() throws IOException { if (!readyBuffer()) { return -1; } return _encodedBytes[_bufferPosition++] & 255; }
@Override public int read(final byte[] buffer) throws IOException { return read(buffer, 0, buffer.length); }
@Override public void close() throws IOException { _bufferPosition = _bufferLength = 0; byte[] buf = _encodedBytes; if (buf != null) { _encodedBytes = null; _recycler.releaseEncodeBuffer(buf); } if (_encoder != null) { _encoder.close(); } _closeInput(); }
@Override public int read() throws IOException { if (!readyBuffer()) { return -1; } return _encodedBytes[_bufferPosition++] & 255; }
@Override public int read(final byte[] buffer) throws IOException { return read(buffer, 0, buffer.length); }
_closeInput(); // and we can close input source as well return false; _closeInput();
return 0; if (!readyBuffer()) { return -1; do { offset += chunkLength; if (!readyBuffer()) { break;
/** * Overridden to just skip at most a single chunk at a time */ @Override public long skip(long n) throws IOException { if (_inputStreamClosed) { return -1; } int left = (_bufferLength - _bufferPosition); // if none left, must read more: if (left <= 0) { // otherwise must read more to skip... int b = read(); if (b < 0) { // EOF return -1; } // push it back to get accurate skip count --_bufferPosition; left = (_bufferLength - _bufferPosition); } // either way, just skip whatever we have decoded if (left > n) { left = (int) n; } _bufferPosition += left; return left; } /*
_closeInput(); // and we can close input source as well return false; _closeInput();
return 0; if (!readyBuffer()) { return -1; do { offset += chunkLength; if (!readyBuffer()) { break;
/** * Overridden to just skip at most a single chunk at a time */ @Override public long skip(long n) throws IOException { if (_inputStreamClosed) { return -1; } int left = (_bufferLength - _bufferPosition); // if none left, must read more: if (left <= 0) { // otherwise must read more to skip... int b = read(); if (b < 0) { // EOF return -1; } // push it back to get accurate skip count --_bufferPosition; left = (_bufferLength - _bufferPosition); } // either way, just skip whatever we have decoded if (left > n) { left = (int) n; } _bufferPosition += left; return left; } /*
_closeInput(); // and we can close input source as well return false; _closeInput();
return 0; if (!readyBuffer()) { return -1; do { offset += chunkLength; if (!readyBuffer()) { break;
/** * Overridden to just skip at most a single chunk at a time */ @Override public long skip(long n) throws IOException { if (_inputStreamClosed) { return -1; } int left = (_bufferLength - _bufferPosition); // if none left, must read more: if (left <= 0) { // otherwise must read more to skip... int b = read(); if (b < 0) { // EOF return -1; } // push it back to get accurate skip count --_bufferPosition; left = (_bufferLength - _bufferPosition); } // either way, just skip whatever we have decoded if (left > n) { left = (int) n; } _bufferPosition += left; return left; } /*