You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tc...@apache.org on 2009/01/09 10:31:03 UTC

svn commit: r732983 - /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java

Author: tcurdt
Date: Fri Jan  9 01:31:02 2009
New Revision: 732983

URL: http://svn.apache.org/viewvc?rev=732983&view=rev
Log:
applied patch from Christian Grobmeier

always have the full offest
https://issues.apache.org/jira/browse/SANDBOX-274


Modified:
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java?rev=732983&r1=732982&r2=732983&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java (original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java Fri Jan  9 01:31:02 2009
@@ -38,7 +38,7 @@
 		if (offset == 0) {
 			final byte[] expected = "!<arch>\n".getBytes();			
 			final byte[] realized = new byte[expected.length]; 
-			final int read = input.read(realized);
+			final int read = read(realized);
 			if (read != expected.length) {
 				throw new IOException("failed to read header");
 			}
@@ -74,7 +74,7 @@
 		{
 			final byte[] expected = "`\012".getBytes();			
 			final byte[] realized = new byte[expected.length]; 
-			final int read = input.read(realized);
+			final int read = read(realized);
 			if (read != expected.length) {
 				throw new IOException("failed to read entry header");
 			}
@@ -95,9 +95,17 @@
 		offset++;
 		return ret;
 	}
+	
+	public int read(byte b[]) throws IOException {
+		final int ret = read(b, 0, b.length);
+		offset = offset + b.length;
+		return ret;
+	}
 
 	public int read(byte[] b, int off, int len) throws IOException {
-		return this.input.read(b, off, len);
+		final int ret = this.input.read(b, off, len);
+		offset = offset + off;
+		return ret;
 	}
 	
 	public static boolean matches( byte[] signature ) {