Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public ArArchiveEntry getNextEntry() throws IOException {
do {
// If there is a current entry, skip any unread data and padding
if (currentEntry != null) {
IOUtils.skip(this, Long.MAX_VALUE); // Skip to end of current entry
IOUtils.consume(this); // Skip to end of current entry
skipRecordPadding(); // Skip padding to align to the next record
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public ArjArchiveEntry getNextEntry() throws IOException {
if (currentInputStream != null) {
// return value ignored as IOUtils.skip ensures the stream is drained completely
final InputStream input = currentInputStream;
IOUtils.skip(input, Long.MAX_VALUE);
IOUtils.consume(input);
currentInputStream.close();
currentLocalFileHeader = null;
currentInputStream = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,6 @@ public void close() throws IOException {
}
}

/**
* Closes the current CPIO entry and positions the stream for reading the next entry.
*
* @throws IOException if an I/O error has occurred or if a CPIO file error has occurred
*/
private void closeEntry() throws IOException {
// the skip implementation of this class will not skip more
// than Integer.MAX_VALUE bytes
while (skip((long) Integer.MAX_VALUE) == Integer.MAX_VALUE) { // NOPMD NOSONAR
// do nothing
}
}

/**
* Reads the next CPIO file entry and positions stream at the beginning of the entry data.
*
Expand All @@ -332,7 +319,7 @@ private void closeEntry() throws IOException {
public CpioArchiveEntry getNextCPIOEntry() throws IOException {
checkOpen();
if (entry != null) {
closeEntry();
IOUtils.consume(this);
}
readFully(buffer2, 0, buffer2.length);
if (CpioUtil.byteArray2long(buffer2, false) == MAGIC_OLD_BINARY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ private InputStream getCurrentStream() throws IOException {
// 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 (InputStream stream = deferredBlockStreams.remove(0)) {
IOUtils.skip(stream, Long.MAX_VALUE);
IOUtils.consume(stream);
}
compressedBytesReadFromCurrentEntry = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public TarArchiveEntry getNextEntry() throws IOException {
do {
// If there is a current entry, skip any unread data and padding
if (currentInputStream != null) {
IOUtils.skip(currentInputStream, Long.MAX_VALUE); // Skip to end of current entry
IOUtils.consume(currentInputStream); // Skip to end of current entry
skipRecordPadding(); // Skip padding to align to the next record
}
// Read the next header record
Expand Down