You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2014/05/02 06:28:04 UTC
svn commit: r1591813 - in /commons/proper/compress/trunk/src:
changes/changes.xml
main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
Author: bodewig
Date: Fri May 2 04:28:04 2014
New Revision: 1591813
URL: http://svn.apache.org/r1591813
Log:
COMPRESS-280 don't call read in TarArchiveInputStream#skip
Modified:
commons/proper/compress/trunk/src/changes/changes.xml
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
Modified: commons/proper/compress/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1591813&r1=1591812&r2=1591813&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Fri May 2 04:28:04 2014
@@ -83,6 +83,11 @@ The <action> type attribute can be add,u
encounters a truncated archive while reading from the last
entry.
</action>
+ <action type="fix" date="2014-05-02" issue="COMPRESS-280"
+ due-to="BELUGA BEHR">
+ Adapted TarArchiveInputStream#skip to the modified
+ IOUtils#skip method.
+ </action>
</release>
<release version="1.8" date="2014-03-12"
description="Release 1.8">
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java?rev=1591813&r1=1591812&r2=1591813&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java Fri May 2 04:28:04 2014
@@ -180,23 +180,28 @@ public class TarArchiveInputStream exten
return (int) (entrySize - entryOffset);
}
+
/**
- * Skip bytes in the input buffer. This skips bytes in the
- * current entry's data, not the entire archive, and will
- * stop at the end of the current entry's data if the number
- * to skip extends beyond that point.
- *
- * @param numToSkip The number of bytes to skip.
- * @return the number actually skipped
- * @throws IOException on error
+ * 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.
+ * @exception IOException
+ * if some other I/O error occurs.
*/
@Override
- public long skip(long numToSkip) throws IOException {
-
- long available = entrySize - entryOffset;
- numToSkip = Math.min(numToSkip, available);
+ public long skip(final long n) throws IOException {
- long skipped = IOUtils.skip(is, numToSkip);
+ final long available = entrySize - entryOffset;
+ final long skipped = is.skip(Math.min(n, available));
count(skipped);
entryOffset += skipped;
return skipped;
@@ -229,7 +234,7 @@ public class TarArchiveInputStream exten
if (currEntry != null) {
/* Skip will only go to the end of the current entry */
- skip(Long.MAX_VALUE);
+ IOUtils.skip(this, Long.MAX_VALUE);
/* skip to the end of the last record */
skipRecordPadding();