diff --git a/proposal/myrmidon/src/java/org/apache/aut/tar/TarInputStream.java b/proposal/myrmidon/src/java/org/apache/aut/tar/TarInputStream.java index 1a2dd1547..47558c7f0 100644 --- a/proposal/myrmidon/src/java/org/apache/aut/tar/TarInputStream.java +++ b/proposal/myrmidon/src/java/org/apache/aut/tar/TarInputStream.java @@ -415,7 +415,8 @@ public class TarInputStream // properly skip over bytes via the TarBuffer... // final byte[] skipBuf = new byte[ 8 * 1024 ]; - for( int num = numToSkip; num > 0; ) + int num = numToSkip; + while( num > 0 ) { final int count = ( num > skipBuf.length ) ? skipBuf.length : num; final int numRead = read( skipBuf, 0, count ); diff --git a/proposal/myrmidon/src/java/org/apache/aut/tar/TarUtils.java b/proposal/myrmidon/src/java/org/apache/aut/tar/TarUtils.java index 84607748b..2e608444e 100644 --- a/proposal/myrmidon/src/java/org/apache/aut/tar/TarUtils.java +++ b/proposal/myrmidon/src/java/org/apache/aut/tar/TarUtils.java @@ -24,7 +24,10 @@ class TarUtils * @param buf Description of Parameter * @return The integer value of the entry's checksum. */ - public static int getCheckSumOctalBytes( long value, byte[] buf, int offset, int length ) + public static int getCheckSumOctalBytes( final long value, + final byte[] buf, + final int offset, + final int length ) { getOctalBytes( value, buf, offset, length ); @@ -43,7 +46,10 @@ class TarUtils * @param buf Description of Parameter * @return The long value of the octal bytes. */ - public static int getLongOctalBytes( long value, byte[] buf, int offset, int length ) + public static int getLongOctalBytes( final long value, + final byte[] buf, + final int offset, + final int length ) { byte[] temp = new byte[ length + 1 ]; @@ -62,18 +68,21 @@ class TarUtils * @param buf Description of Parameter * @return The number of bytes in a header's entry name. */ - public static int getNameBytes( StringBuffer name, byte[] buf, int offset, int length ) + public static int getNameBytes( final StringBuffer name, + final byte[] buffer, + final int offset, + final int length ) { int i; for( i = 0; i < length && i < name.length(); ++i ) { - buf[ offset + i ] = (byte)name.charAt( i ); + buffer[ offset + i ] = (byte)name.charAt( i ); } for( ; i < length; ++i ) { - buf[ offset + i ] = 0; + buffer[ offset + i ] = 0; } return offset + length; @@ -87,34 +96,37 @@ class TarUtils * @return The integer value of the octal bytes. */ public static int getOctalBytes( final long value, - final byte[] buf, + final byte[] buffer, final int offset, final int length ) { int idx = length - 1; - buf[ offset + idx ] = 0; + buffer[ offset + idx ] = 0; --idx; - buf[ offset + idx ] = (byte)' '; + buffer[ offset + idx ] = (byte)' '; --idx; if( value == 0 ) { - buf[ offset + idx ] = (byte)'0'; + buffer[ offset + idx ] = (byte)'0'; --idx; } else { - for( long val = value; idx >= 0 && val > 0; --idx ) + long val = value; + while( idx >= 0 && val > 0 ) { - buf[ offset + idx ] = (byte)( (byte)'0' + (byte)( val & 7 ) ); + buffer[ offset + idx ] = (byte)( (byte)'0' + (byte)( val & 7 ) ); val = val >> 3; + idx--; } } - for( ; idx >= 0; --idx ) + while( idx >= 0 ) { - buf[ offset + idx ] = (byte)' '; + buffer[ offset + idx ] = (byte)' '; + idx--; } return offset + length; @@ -126,13 +138,13 @@ class TarUtils * @param buf The tar entry's header buffer. * @return The computed checksum. */ - public static long computeCheckSum( byte[] buf ) + public static long computeCheckSum( final byte[] buffer ) { long sum = 0; - for( int i = 0; i < buf.length; ++i ) + for( int i = 0; i < buffer.length; ++i ) { - sum += 255 & buf[ i ]; + sum += 255 & buffer[ i ]; } return sum; @@ -146,7 +158,9 @@ class TarUtils * @param length The number of header bytes to parse. * @return The header's entry name. */ - public static StringBuffer parseName( byte[] header, int offset, int length ) + public static StringBuffer parseName( final byte[] header, + final int offset, + final int length ) { StringBuffer result = new StringBuffer( length ); int end = offset + length; @@ -173,7 +187,9 @@ class TarUtils * @param length The number of header bytes to parse. * @return The long value of the octal string. */ - public static long parseOctal( byte[] header, int offset, int length ) + public static long parseOctal( final byte[] header, + final int offset, + final int length ) { long result = 0; boolean stillPadding = true;