commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r741475 - in /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers: ar/ArArchiveInputStream.java cpio/CpioArchiveInputStream.java jar/JarArchiveInputStream.java tar/TarArchiveInputStream.java
Date Fri, 06 Feb 2009 08:54:45 GMT
Author: bodewig
Date: Fri Feb  6 08:54:45 2009
New Revision: 741475

URL: http://svn.apache.org/viewvc?rev=741475&view=rev
Log:
whitespace only

Modified:
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.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=741475&r1=741474&r2=741475&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 Feb  6 08:54:45 2009
@@ -26,117 +26,117 @@
 
 public class ArArchiveInputStream extends ArchiveInputStream {
 
-	private final InputStream input;
-	private long offset = 0;
-	
-	public ArArchiveInputStream( final InputStream pInput ) {
-		input = pInput;
-	}
-	
-	public ArchiveEntry getNextEntry() throws IOException {
-		
-		if (offset == 0) {
-			final byte[] expected = "!<arch>\n".getBytes();			
-			final byte[] realized = new byte[expected.length]; 
-			final int read = read(realized);
-			if (read != expected.length) {
-				throw new IOException("failed to read header");
-			}
-			for (int i = 0; i < expected.length; i++) {
-				if (expected[i] != realized[i]) {
-					throw new IOException("invalid header " + new String(realized));
-				}
-			}
-		}
-
-		if (input.available() == 0) {
-			return null;
-		}
-				
-		if (offset % 2 != 0) {
-			read();
-		}
-
-		final byte[] name = new byte[16];
-		final byte[] lastmodified = new byte[12];
-		final byte[] userid = new byte[6];
-		final byte[] groupid = new byte[6];
-		final byte[] filemode = new byte[8];
-		final byte[] length = new byte[10];
-		
-		read(name);
-		read(lastmodified);
-		read(userid);
-		read(groupid);
-		read(filemode);
-		read(length);
-
-		{
-			final byte[] expected = "`\012".getBytes();			
-			final byte[] realized = new byte[expected.length]; 
-			final int read = read(realized);
-			if (read != expected.length) {
-				throw new IOException("failed to read entry header");
-			}
-			for (int i = 0; i < expected.length; i++) {
-				if (expected[i] != realized[i]) {
-					throw new IOException("invalid entry header. not read the content?");
-				}
-			}
-		}
-		
-		return new ArArchiveEntry(new String(name).trim(), Long.parseLong(new String(length).trim()));
-	
-	}
-	
-	
-	public int read() throws IOException {
-		final int ret = input.read();
-		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 {
-		final int ret = this.input.read(b, off, len);
-		offset = offset + off;
-		return ret;
-	}
-	
-	public static boolean matches( byte[] signature ) {
-		// 3c21 7261 6863 0a3e
-    	
-    	if (signature[0] != 0x21) {
-    		return false;
-    	}
-    	if (signature[1] != 0x3c) {
-    		return false;
-    	}
-    	if (signature[2] != 0x61) {
-    		return false;
-    	}
-    	if (signature[3] != 0x72) {
-    		return false;
-    	}
-    	if (signature[4] != 0x63) {
-    		return false;
-    	}
-    	if (signature[5] != 0x68) {
-    		return false;
-    	}
-    	if (signature[6] != 0x3e) {
-    		return false;
-    	}
-    	if (signature[7] != 0x0a) {
-    		return false;
-    	}
-    	
-    	return true;
-	}
+    private final InputStream input;
+    private long offset = 0;
+        
+    public ArArchiveInputStream( final InputStream pInput ) {
+        input = pInput;
+    }
+        
+    public ArchiveEntry getNextEntry() throws IOException {
+                
+        if (offset == 0) {
+            final byte[] expected = "!<arch>\n".getBytes();                     
+            final byte[] realized = new byte[expected.length]; 
+            final int read = read(realized);
+            if (read != expected.length) {
+                throw new IOException("failed to read header");
+            }
+            for (int i = 0; i < expected.length; i++) {
+                if (expected[i] != realized[i]) {
+                    throw new IOException("invalid header " + new String(realized));
+                }
+            }
+        }
+
+        if (input.available() == 0) {
+            return null;
+        }
+                                
+        if (offset % 2 != 0) {
+            read();
+        }
+
+        final byte[] name = new byte[16];
+        final byte[] lastmodified = new byte[12];
+        final byte[] userid = new byte[6];
+        final byte[] groupid = new byte[6];
+        final byte[] filemode = new byte[8];
+        final byte[] length = new byte[10];
+                
+        read(name);
+        read(lastmodified);
+        read(userid);
+        read(groupid);
+        read(filemode);
+        read(length);
+
+        {
+            final byte[] expected = "`\012".getBytes();                 
+            final byte[] realized = new byte[expected.length]; 
+            final int read = read(realized);
+            if (read != expected.length) {
+                throw new IOException("failed to read entry header");
+            }
+            for (int i = 0; i < expected.length; i++) {
+                if (expected[i] != realized[i]) {
+                    throw new IOException("invalid entry header. not read the content?");
+                }
+            }
+        }
+                
+        return new ArArchiveEntry(new String(name).trim(), Long.parseLong(new String(length).trim()));
+        
+    }
+        
+        
+    public int read() throws IOException {
+        final int ret = input.read();
+        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 {
+        final int ret = this.input.read(b, off, len);
+        offset = offset + off;
+        return ret;
+    }
+        
+    public static boolean matches( byte[] signature ) {
+        // 3c21 7261 6863 0a3e
+        
+        if (signature[0] != 0x21) {
+            return false;
+        }
+        if (signature[1] != 0x3c) {
+            return false;
+        }
+        if (signature[2] != 0x61) {
+            return false;
+        }
+        if (signature[3] != 0x72) {
+            return false;
+        }
+        if (signature[4] != 0x63) {
+            return false;
+        }
+        if (signature[5] != 0x68) {
+            return false;
+        }
+        if (signature[6] != 0x3e) {
+            return false;
+        }
+        if (signature[7] != 0x0a) {
+            return false;
+        }
+        
+        return true;
+    }
 
 }

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java?rev=741475&r1=741474&r2=741475&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
Fri Feb  6 08:54:45 2009
@@ -58,7 +58,7 @@
  */
 
 public class CpioArchiveInputStream extends ArchiveInputStream implements CpioConstants {
-	
+        
     private boolean closed = false;
 
     private CpioArchiveEntry entry;
@@ -202,7 +202,7 @@
             byte tmp[] = new byte[6];
             System.arraycopy(magic, 0, tmp, 0, magic.length);
             System.arraycopy(more_magic, 0, tmp, magic.length,
-                    more_magic.length);
+                             more_magic.length);
             String magicString = new String(tmp);
             if (magicString.equals(MAGIC_NEW)) {
                 this.entry = readNewEntry(false);
@@ -244,7 +244,7 @@
      */
     public int read() throws IOException {
         return read(this.singleByteBuf, 0, 1) == -1 ? -1
-                : this.singleByteBuf[0] & 0xff;
+            : this.singleByteBuf[0] & 0xff;
     }
 
     /**
@@ -260,7 +260,7 @@
      *                     occurred
      */
     public int read(final byte[] b, final int off, final int len)
-            throws IOException {
+        throws IOException {
         ensureOpen();
         if (off < 0 || len < 0 || off > b.length - len) {
             throw new IndexOutOfBoundsException();
@@ -286,7 +286,7 @@
             return -1;
         }
         int tmplength = (int) Math.min(len, this.entry.getSize()
-                - this.entryBytesRead);
+                                       - this.entryBytesRead);
         if (tmplength < 0) {
             return -1;
         }
@@ -303,7 +303,7 @@
     }
 
     private final int readFully(final byte[] b, final int off, final int len)
-            throws IOException {
+        throws IOException {
         if (len < 0) {
             throw new IndexOutOfBoundsException();
         }
@@ -319,14 +319,14 @@
     }
 
     private long readBinaryLong(final int length, final boolean swapHalfWord)
-            throws IOException {
+        throws IOException {
         byte tmp[] = new byte[length];
         readFully(tmp, 0, tmp.length);
         return byteArray2long(tmp, swapHalfWord);
     }
 
     private long readAsciiLong(final int length, final int radix)
-            throws IOException {
+        throws IOException {
         byte tmpBuffer[] = new byte[length];
         readFully(tmpBuffer, 0, tmpBuffer.length);
         return Long.parseLong(new String(tmpBuffer), radix);
@@ -378,7 +378,7 @@
     }
 
     private CpioArchiveEntry readOldBinaryEntry(final boolean swapHalfWord)
-            throws IOException {
+        throws IOException {
         CpioArchiveEntry ret = new CpioArchiveEntry(FORMAT_OLD_BINARY);
 
         ret.setDevice(readBinaryLong(2, swapHalfWord));
@@ -434,33 +434,33 @@
         return total;
     }
 
-	public ArchiveEntry getNextEntry() throws IOException {
-		CpioArchiveEntry entry = this.getNextCPIOEntry();
-    	if(entry == null) {
-    		return null;
-    	}
-		return (ArchiveEntry)entry;
-	}
-	
-	public static boolean matches( byte[] signature ) {
-		// 3037 3037 30
-    	
-    	if (signature[0] != 0x30) {
-    		return false;
-    	}
-    	if (signature[1] != 0x37) {
-    		return false;
-    	}
-    	if (signature[2] != 0x30) {
-    		return false;
-    	}
-    	if (signature[3] != 0x37) {
-    		return false;
-    	}
-    	if (signature[4] != 0x30) {
-    		return false;
-    	}
-    	
-    	return true;
-	}
+    public ArchiveEntry getNextEntry() throws IOException {
+        CpioArchiveEntry entry = this.getNextCPIOEntry();
+        if(entry == null) {
+            return null;
+        }
+        return (ArchiveEntry)entry;
+    }
+        
+    public static boolean matches( byte[] signature ) {
+        // 3037 3037 30
+        
+        if (signature[0] != 0x30) {
+            return false;
+        }
+        if (signature[1] != 0x37) {
+            return false;
+        }
+        if (signature[2] != 0x30) {
+            return false;
+        }
+        if (signature[3] != 0x37) {
+            return false;
+        }
+        if (signature[4] != 0x30) {
+            return false;
+        }
+        
+        return true;
+    }
 }

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java?rev=741475&r1=741474&r2=741475&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
Fri Feb  6 08:54:45 2009
@@ -27,47 +27,47 @@
 
 public class JarArchiveInputStream extends ZipArchiveInputStream {
 
-	public JarArchiveInputStream( final InputStream inputStream ) {
-		super(inputStream);
-	}
-	
-	public ArchiveEntry getNextEntry() throws IOException {
-		ZipArchiveEntry entry = (ZipArchiveEntry)super.getNextEntry();
-		if(entry == null) {
-			return null;
-		} else {
-			return (ArchiveEntry)new JarArchiveEntry(entry);
-		}
-	}
-	
-	public static boolean matches( byte[] signature ) {
-		// 4b50 0403 0014 0008
+    public JarArchiveInputStream( final InputStream inputStream ) {
+        super(inputStream);
+    }
+        
+    public ArchiveEntry getNextEntry() throws IOException {
+        ZipArchiveEntry entry = (ZipArchiveEntry)super.getNextEntry();
+        if(entry == null) {
+            return null;
+        } else {
+            return (ArchiveEntry)new JarArchiveEntry(entry);
+        }
+    }
+        
+    public static boolean matches( byte[] signature ) {
+        // 4b50 0403 0014 0008
 
-    	if (signature[0] != 0x50) {
-    		return false;
-    	}
-    	if (signature[1] != 0x4b) {
-    		return false;
-    	}
-    	if (signature[2] != 0x03) {
-    		return false;
-    	}
-    	if (signature[3] != 0x04) {
-    		return false;
-    	}
-    	if (signature[4] != 0x14) {
-    		return false;
-    	}
-    	if (signature[5] != 0x00) {
-    		return false;
-    	}
-    	if (signature[6] != 0x08) {
-    		return false;
-    	}
-    	if (signature[7] != 0x00) {
-    		return false;
-    	}
-    	
-    	return true;
-	}
+        if (signature[0] != 0x50) {
+            return false;
+        }
+        if (signature[1] != 0x4b) {
+            return false;
+        }
+        if (signature[2] != 0x03) {
+            return false;
+        }
+        if (signature[3] != 0x04) {
+            return false;
+        }
+        if (signature[4] != 0x14) {
+            return false;
+        }
+        if (signature[5] != 0x00) {
+            return false;
+        }
+        if (signature[6] != 0x08) {
+            return false;
+        }
+        if (signature[7] != 0x00) {
+            return false;
+        }
+        
+        return true;
+    }
 }

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java?rev=741475&r1=741474&r2=741475&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
Fri Feb  6 08:54:45 2009
@@ -26,11 +26,11 @@
 
 public class TarArchiveInputStream extends ArchiveInputStream {
 
-	private final TarInputStream in;
+    private final TarInputStream in;
     
-	public TarArchiveInputStream( InputStream inputStream ) {
-		in = new TarInputStream(inputStream);
-	}
+    public TarArchiveInputStream( InputStream inputStream ) {
+        in = new TarInputStream(inputStream);
+    }
 
     public ArchiveEntry getNextEntry() throws IOException {
         return (ArchiveEntry)in.getNextEntry();
@@ -45,34 +45,34 @@
     }
     
     public static boolean matches( byte[] signature ) {
-    	// 6574 7473 2e31 6d78
-    	
-    	if (signature[0] != 0x74) {
-    		return false;
-    	}
-    	if (signature[1] != 0x65) {
-    		return false;
-    	}
-    	if (signature[2] != 0x73) {
-    		return false;
-    	}
-    	if (signature[3] != 0x74) {
-    		return false;
-    	}
-    	if (signature[4] != 0x31) {
-    		return false;
-    	}
-    	if (signature[5] != 0x2e) {
-    		return false;
-    	}
-    	if (signature[6] != 0x78) {
-    		return false;
-    	}
-    	if (signature[7] != 0x6d) {
-    		return false;
-    	}
-    	
-    	return true;
+        // 6574 7473 2e31 6d78
+        
+        if (signature[0] != 0x74) {
+            return false;
+        }
+        if (signature[1] != 0x65) {
+            return false;
+        }
+        if (signature[2] != 0x73) {
+            return false;
+        }
+        if (signature[3] != 0x74) {
+            return false;
+        }
+        if (signature[4] != 0x31) {
+            return false;
+        }
+        if (signature[5] != 0x2e) {
+            return false;
+        }
+        if (signature[6] != 0x78) {
+            return false;
+        }
+        if (signature[7] != 0x6d) {
+            return false;
+        }
+        
+        return true;
     }
     
 }



Mime
View raw message