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/06/21 07:22:55 UTC
svn commit: r1604313 -
/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
Author: bodewig
Date: Sat Jun 21 05:22:54 2014
New Revision: 1604313
URL: http://svn.apache.org/r1604313
Log:
micro-optimization
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
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=1604313&r1=1604312&r2=1604313&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 Sat Jun 21 05:22:54 2014
@@ -211,6 +211,25 @@ public class TarArchiveInputStream exten
}
/**
+ * Since we do not support marking just yet, we return false.
+ *
+ * @return False.
+ */
+ @Override
+ public boolean markSupported() {
+ return false;
+ }
+
+ /**
+ * Since we do not support marking just yet, we do nothing.
+ *
+ * @param markLimit The limit to mark.
+ */
+ @Override
+ public void mark(int markLimit) {
+ }
+
+ /**
* Since we do not support marking just yet, we do nothing.
*/
@Override
@@ -425,18 +444,19 @@ public class TarArchiveInputStream exten
if (ch == '='){ // end of keyword
String keyword = coll.toString(CharsetNames.UTF_8);
// Get rest of entry
- byte[] rest = new byte[len - read];
+ final int restLen = len - read;
+ byte[] rest = new byte[restLen];
int got = IOUtils.readFully(i, rest);
- if (got != len - read){
+ if (got != restLen) {
throw new IOException("Failed to read "
+ "Paxheader. Expected "
- + (len - read)
+ + restLen
+ " bytes, read "
+ got);
}
// Drop trailing NL
String value = new String(rest, 0,
- len - read - 1, CharsetNames.UTF_8);
+ restLen - 1, CharsetNames.UTF_8);
headers.put(keyword, value);
break;
}