/** {@inheritDoc} */ @Override public long skip(final long n) throws IOException { return IOUtils.skip(in, n); }
@Override public long skip(final long n) throws IOException { return IOUtils.skip(decIS, n); }
/** {@inheritDoc} */ @Override public long skip(final long n) throws IOException { return IOUtils.skip(in, n); }
@Override public long skip(final long n) throws IOException { return IOUtils.skip(decIS, n); }
@Override public long skip(final long n) throws IOException { final long toSkip = max >= 0 ? Math.min(n, max - pos) : n; final long skippedBytes = IOUtils.skip(in, toSkip); pos += skippedBytes; return skippedBytes; }
@Override public long skip(final long count) throws IOException { return IOUtils.skip(streamBridge.getInput(), count); }
private InputStream getCurrentStream() throws IOException { if (archive.files[currentEntryIndex].getSize() == 0) { return new ByteArrayInputStream(new byte[0]); } if (deferredBlockStreams.isEmpty()) { throw new IllegalStateException("No current 7z entry (call getNextEntry() first)."); } while (deferredBlockStreams.size() > 1) { // In solid compression mode we need to decompress all leading folder' // streams to get access to an entry. We defer this until really needed // so that entire blocks can be skipped without wasting time for decompression. try (final InputStream stream = deferredBlockStreams.remove(0)) { IOUtils.skip(stream, Long.MAX_VALUE); } compressedBytesReadFromCurrentEntry = 0; } return deferredBlockStreams.get(0); }
private void skipBlock() throws IOException { final int size = readSize(); final long read = IOUtils.skip(in, size); count(read); if (read != size) { throw new IOException("premature end of stream"); } }
/** * This method is invoked once the end of the archive is hit, it * tries to consume the remaining bytes under the assumption that * the tool creating this archive has padded the last block. */ private void consumeRemainderOfLastBlock() throws IOException { final long bytesReadOfLastBlock = getBytesRead() % blockSize; if (bytesReadOfLastBlock > 0) { final long skipped = IOUtils.skip(is, blockSize - bytesReadOfLastBlock); count(skipped); } }
/** * The last record block should be written at the full size, so skip any * additional space used to fill a record after an entry */ private void skipRecordPadding() throws IOException { if (!isDirectory() && this.entrySize > 0 && this.entrySize % this.recordSize != 0) { final long numRecords = (this.entrySize / this.recordSize) + 1; final long padding = (numRecords * this.recordSize) - this.entrySize; final long skipped = IOUtils.skip(is, padding); count(skipped); } }
/** * Skips over and discards <code>n</code> bytes of data from this input * stream. The <code>skip</code> method may, for a variety of reasons, end * up skipping over some smaller number of bytes, possibly <code>0</code>. * This may result from any of a number of conditions; reaching end of file * or end of entry before <code>n</code> bytes have been skipped; are only * two possibilities. The actual number of bytes skipped is returned. If * <code>n</code> is negative, no bytes are skipped. * * * @param n * the number of bytes to be skipped. * @return the actual number of bytes skipped. * @throws IOException * if some other I/O error occurs. */ @Override public long skip(final long n) throws IOException { if (n <= 0 || isDirectory()) { return 0; } final long available = entrySize - entryOffset; final long skipped = IOUtils.skip(is, Math.min(n, available)); count(skipped); entryOffset += skipped; return skipped; }
@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); } }
if (IOUtils.skip(in, skipAmount) != skipAmount) { throw new IOException();
@Override public ArjArchiveEntry getNextEntry() throws IOException { if (currentInputStream != null) { // return value ignored as IOUtils.skip ensures the stream is drained completely IOUtils.skip(currentInputStream, Long.MAX_VALUE); currentInputStream.close(); currentLocalFileHeader = null; currentInputStream = null; } currentLocalFileHeader = readLocalFileHeader(); if (currentLocalFileHeader != null) { currentInputStream = new BoundedInputStream(in, currentLocalFileHeader.compressedSize); if (currentLocalFileHeader.method == LocalFileHeader.Methods.STORED) { currentInputStream = new CRC32VerifyingInputStream(currentInputStream, currentLocalFileHeader.originalSize, currentLocalFileHeader.originalCrc32); } return new ArjArchiveEntry(currentLocalFileHeader); } currentInputStream = null; return null; }
/** * Skips over the contents of a skippable frame as well as * skippable frames following it. * * <p>It then tries to read four more bytes which are supposed to * hold an LZ4 signature and returns the number of bytes read * while storing the bytes in the given array.</p> */ private int skipSkippableFrame(byte[] b) throws IOException { int read = 4; while (read == 4 && isSkippableFrameSignature(b)) { long len = ByteUtils.fromLittleEndian(supplier, 4); long skipped = IOUtils.skip(in, len); count(skipped); if (len != skipped) { throw new IOException("Premature end of stream while skipping frame"); } read = IOUtils.readFully(in, b); count(read); } return read; }
if (currentEntry != null) { final long entryEnd = entryOffset + currentEntry.getLength(); long skipped = IOUtils.skip(input, entryEnd - offset); trackReadBytes(skipped); currentEntry = null;
IOUtils.skip(this, Long.MAX_VALUE);
private void skipBlock() throws IOException { final int size = readSize(); final long read = IOUtils.skip(in, size); count(read); if (read != size) { throw new IOException("premature end of stream"); } }
/** * This method is invoked once the end of the archive is hit, it * tries to consume the remaining bytes under the assumption that * the tool creating this archive has padded the last block. */ private void consumeRemainderOfLastBlock() throws IOException { final long bytesReadOfLastBlock = getBytesRead() % blockSize; if (bytesReadOfLastBlock > 0) { final long skipped = IOUtils.skip(is, blockSize - bytesReadOfLastBlock); count(skipped); } }
/** * The last record block should be written at the full size, so skip any * additional space used to fill a record after an entry */ private void skipRecordPadding() throws IOException { if (!isDirectory() && this.entrySize > 0 && this.entrySize % this.recordSize != 0) { final long numRecords = (this.entrySize / this.recordSize) + 1; final long padding = (numRecords * this.recordSize) - this.entrySize; final long skipped = IOUtils.skip(is, padding); count(skipped); } }