From 4058f2a97f7dc93772debc5bfd54f193e51f0256 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sat, 22 Dec 2001 12:58:59 +0000 Subject: [PATCH] restyled git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270312 13f79535-47bb-0310-9956-ffa450edef68 --- .../compilers/DefaultCompilerAdapter.java | 1 - .../tools/ant/taskdefs/condition/And.java | 1 - .../ant/taskdefs/condition/ConditionBase.java | 3 +- .../apache/tools/ant/taskdefs/file/Copy.java | 5 +- .../tools/ant/taskdefs/file/Delete.java | 4 +- .../apache/tools/ant/taskdefs/file/Move.java | 5 +- .../ant/taskdefs/rmic/DefaultRmicAdapter.java | 2 +- .../apache/tools/ant/types/Commandline.java | 2 +- .../org/apache/tools/ant/types/FileList.java | 2 +- .../org/apache/tools/ant/types/FileSet.java | 2 +- .../org/apache/tools/ant/types/FilterSet.java | 6 +- .../tools/ant/types/FilterSetCollection.java | 2 +- .../main/org/apache/tools/ant/types/Path.java | 2 +- .../apache/tools/ant/types/PatternSet.java | 4 +- .../tools/ant/util/SourceFileScanner.java | 14 +- .../apache/tools/bzip2/BZip2Constants.java | 2 +- .../apache/tools/bzip2/CBZip2InputStream.java | 260 +++---- .../tools/bzip2/CBZip2OutputStream.java | 660 +++++++++--------- .../src/main/org/apache/tools/bzip2/CRC.java | 4 +- .../org/apache/tools/mail/MailMessage.java | 16 +- .../apache/tools/mail/SmtpResponseReader.java | 1 + .../main/org/apache/tools/tar/TarBuffer.java | 47 +- .../org/apache/tools/tar/TarConstants.java | 18 +- .../main/org/apache/tools/tar/TarEntry.java | 33 +- .../org/apache/tools/tar/TarInputStream.java | 95 +-- .../org/apache/tools/tar/TarOutputStream.java | 38 +- .../main/org/apache/tools/tar/TarUtils.java | 36 +- .../org/apache/tools/zip/AsiExtraField.java | 35 +- .../tools/zip/UnrecognizedExtraField.java | 2 +- .../main/org/apache/tools/zip/ZipEntry.java | 23 +- .../org/apache/tools/zip/ZipExtraField.java | 1 + .../main/org/apache/tools/zip/ZipLong.java | 22 +- .../org/apache/tools/zip/ZipOutputStream.java | 45 +- .../main/org/apache/tools/zip/ZipShort.java | 12 +- .../compilers/DefaultCompilerAdapter.java | 1 - .../tools/ant/taskdefs/condition/And.java | 1 - .../ant/taskdefs/condition/ConditionBase.java | 3 +- .../apache/tools/ant/taskdefs/file/Copy.java | 5 +- .../tools/ant/taskdefs/file/Delete.java | 4 +- .../apache/tools/ant/taskdefs/file/Move.java | 5 +- .../ant/taskdefs/rmic/DefaultRmicAdapter.java | 2 +- .../apache/tools/ant/types/Commandline.java | 2 +- .../org/apache/tools/ant/types/FileList.java | 2 +- .../org/apache/tools/ant/types/FileSet.java | 2 +- .../org/apache/tools/ant/types/FilterSet.java | 6 +- .../tools/ant/types/FilterSetCollection.java | 2 +- .../todo/org/apache/tools/ant/types/Path.java | 2 +- .../apache/tools/ant/types/PatternSet.java | 4 +- .../tools/ant/util/SourceFileScanner.java | 14 +- .../apache/tools/bzip2/BZip2Constants.java | 2 +- .../apache/tools/bzip2/CBZip2InputStream.java | 260 +++---- .../tools/bzip2/CBZip2OutputStream.java | 660 +++++++++--------- .../src/todo/org/apache/tools/bzip2/CRC.java | 4 +- .../org/apache/tools/mail/MailMessage.java | 16 +- .../apache/tools/mail/SmtpResponseReader.java | 1 + .../todo/org/apache/tools/tar/TarBuffer.java | 47 +- .../org/apache/tools/tar/TarConstants.java | 18 +- .../todo/org/apache/tools/tar/TarEntry.java | 33 +- .../org/apache/tools/tar/TarInputStream.java | 95 +-- .../org/apache/tools/tar/TarOutputStream.java | 38 +- .../todo/org/apache/tools/tar/TarUtils.java | 36 +- .../org/apache/tools/zip/AsiExtraField.java | 35 +- .../tools/zip/UnrecognizedExtraField.java | 2 +- .../todo/org/apache/tools/zip/ZipEntry.java | 23 +- .../org/apache/tools/zip/ZipExtraField.java | 1 + .../todo/org/apache/tools/zip/ZipLong.java | 22 +- .../org/apache/tools/zip/ZipOutputStream.java | 45 +- .../todo/org/apache/tools/zip/ZipShort.java | 12 +- 68 files changed, 1418 insertions(+), 1392 deletions(-) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 1186cc5ed..fb5eef31a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -437,7 +437,6 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter Execute exe = new Execute( new LogStreamHandler( attributes, Project.MSG_INFO, Project.MSG_WARN ) ); - exe.setAntRun( project ); exe.setWorkingDirectory( project.getBaseDir() ); exe.setCommandline( commandArray ); exe.execute(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/And.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/And.java index 3f3631a9d..7c99b98fa 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/And.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/And.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.taskdefs.condition; -import java.util.Iterator; import java.util.Enumeration; import org.apache.myrmidon.api.TaskException; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java index cc33bd4b3..a3e441ac8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java @@ -7,10 +7,9 @@ */ package org.apache.tools.ant.taskdefs.condition; -import java.util.Iterator; -import java.util.NoSuchElementException; import java.util.ArrayList; import java.util.Enumeration; +import java.util.NoSuchElementException; import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.taskdefs.Available; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Copy.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Copy.java index fdc0ac145..d9b165904 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Copy.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Copy.java @@ -10,10 +10,9 @@ package org.apache.tools.ant.taskdefs.file; import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.Iterator; -import java.util.Hashtable; -import java.util.ArrayList; import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Delete.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Delete.java index f306977ca..9f3a58d97 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Delete.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Delete.java @@ -457,8 +457,8 @@ public class Delete if( dirCount > 0 ) { getLogger().info( "Deleted " + dirCount + " director" + - ( dirCount == 1 ? "y" : "ies" ) + - " from " + d.getAbsolutePath() ); + ( dirCount == 1 ? "y" : "ies" ) + + " from " + d.getAbsolutePath() ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java index 324c52ca3..b429e3234 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java @@ -9,16 +9,15 @@ package org.apache.tools.ant.taskdefs.file; import java.io.File; import java.io.IOException; -import java.util.Iterator; -import java.util.Iterator; import java.util.Enumeration; +import java.util.Iterator; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; -import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FilterSet; import org.apache.tools.ant.types.FilterSetCollection; +import org.apache.tools.ant.util.FileUtils; /** * Moves a file or directory to a new file or directory. By default, the diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index cabff316a..51e8f9d9c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -8,8 +8,8 @@ package org.apache.tools.ant.taskdefs.rmic; import java.io.File; -import java.util.Random; import java.util.ArrayList; +import java.util.Random; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Rmic; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java index c6b275269..ec9e0af9e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java @@ -8,8 +8,8 @@ package org.apache.tools.ant.types; import java.io.File; -import java.util.StringTokenizer; import java.util.ArrayList; +import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileList.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileList.java index 87f6c7c88..e592ef15d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileList.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileList.java @@ -8,9 +8,9 @@ package org.apache.tools.ant.types; import java.io.File; +import java.util.ArrayList; import java.util.Stack; import java.util.StringTokenizer; -import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java index c267e6d0a..1504800c3 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java @@ -8,8 +8,8 @@ package org.apache.tools.ant.types; import java.io.File; -import java.util.Stack; import java.util.ArrayList; +import java.util.Stack; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.FileScanner; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java index f53090c8a..d32fb094f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java @@ -10,11 +10,11 @@ package org.apache.tools.ant.types;// java io classes import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.util.Iterator; -import java.util.Hashtable; -import java.util.Properties; import java.util.ArrayList; import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Properties; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSetCollection.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSetCollection.java index 99996b479..2d9d54622 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSetCollection.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSetCollection.java @@ -9,8 +9,8 @@ package org.apache.tools.ant.types;// java io classes // java util classes -import java.util.Iterator; import java.util.ArrayList; +import java.util.Iterator; import org.apache.myrmidon.api.TaskException; // ant classes diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java index 7fac34f05..3667aabe9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java @@ -8,10 +8,10 @@ package org.apache.tools.ant.types; import java.io.File; +import java.util.ArrayList; import java.util.Iterator; import java.util.Locale; import java.util.Stack; -import java.util.ArrayList; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/PatternSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/PatternSet.java index 947e81f39..f3f4b2ee8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/PatternSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/PatternSet.java @@ -11,10 +11,10 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.util.ArrayList; import java.util.Iterator; import java.util.Stack; import java.util.StringTokenizer; -import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; @@ -357,7 +357,7 @@ public class PatternSet extends DataType } final String[] result = new String[ tmpNames.size() ]; - return (String[]) tmpNames.toArray( result ); + return (String[])tmpNames.toArray( result ); } /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java index 65e296239..f502c13cf 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java @@ -9,11 +9,11 @@ package org.apache.tools.ant.util; import java.io.File; import java.util.ArrayList; +import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; -import org.apache.avalon.excalibur.io.FileUtil; /** * Utility class that collects the functionality of the various scanDir methods @@ -78,7 +78,7 @@ public class SourceFileScanner if( targets == null || targets.length == 0 ) { m_task.log( files[ i ] + " skipped - don\'t know how to handle it", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); continue; } @@ -87,7 +87,7 @@ public class SourceFileScanner if( src.lastModified() > now ) { m_task.log( "Warning: " + files[ i ] + " modified in the future.", - Project.MSG_WARN ); + Project.MSG_WARN ); } boolean added = false; @@ -99,14 +99,14 @@ public class SourceFileScanner if( !dest.exists() ) { m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); v.add( files[ i ] ); added = true; } else if( src.lastModified() > dest.lastModified() ) { m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); v.add( files[ i ] ); added = true; } @@ -123,8 +123,8 @@ public class SourceFileScanner if( !added ) { m_task.log( files[ i ] + " omitted as " + targetList.toString() - + ( targets.length == 1 ? " is" : " are " ) - + " up to date.", Project.MSG_VERBOSE ); + + ( targets.length == 1 ? " is" : " are " ) + + " up to date.", Project.MSG_VERBOSE ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/bzip2/BZip2Constants.java b/proposal/myrmidon/src/main/org/apache/tools/bzip2/BZip2Constants.java index fa26ce9fc..63486ab7d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/bzip2/BZip2Constants.java +++ b/proposal/myrmidon/src/main/org/apache/tools/bzip2/BZip2Constants.java @@ -80,5 +80,5 @@ public interface BZip2Constants 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 936, 638 - }; + }; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/bzip2/CBZip2InputStream.java b/proposal/myrmidon/src/main/org/apache/tools/bzip2/CBZip2InputStream.java index d614359db..8f1c4eb65 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/bzip2/CBZip2InputStream.java +++ b/proposal/myrmidon/src/main/org/apache/tools/bzip2/CBZip2InputStream.java @@ -6,7 +6,9 @@ * the LICENSE file. */ package org.apache.tools.bzip2; -import java.io.*; + +import java.io.IOException; +import java.io.InputStream; /** * An input stream that decompresses from the BZip2 format (without the file @@ -26,24 +28,24 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private final static int NO_RAND_PART_C_STATE = 7; private CRC mCrc = new CRC(); - private boolean inUse[] = new boolean[256]; + private boolean inUse[] = new boolean[ 256 ]; - private char seqToUnseq[] = new char[256]; - private char unseqToSeq[] = new char[256]; + private char seqToUnseq[] = new char[ 256 ]; + private char unseqToSeq[] = new char[ 256 ]; - private char selector[] = new char[MAX_SELECTORS]; - private char selectorMtf[] = new char[MAX_SELECTORS]; + private char selector[] = new char[ MAX_SELECTORS ]; + private char selectorMtf[] = new char[ MAX_SELECTORS ]; /* * freq table collected to save a pass over the data * during decompression. */ - private int unzftab[] = new int[256]; + private int unzftab[] = new int[ 256 ]; - private int limit[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; - private int base[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; - private int perm[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; - private int minLens[] = new int[N_GROUPS]; + private int limit[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; + private int base[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; + private int perm[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; + private int minLens[] = new int[ N_GROUPS ]; private boolean streamEnd = false; @@ -146,28 +148,28 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants else { int retChar = currentChar; - switch ( currentState ) + switch( currentState ) { - case START_BLOCK_STATE: - break; - case RAND_PART_A_STATE: - break; - case RAND_PART_B_STATE: - setupRandPartB(); - break; - case RAND_PART_C_STATE: - setupRandPartC(); - break; - case NO_RAND_PART_A_STATE: - break; - case NO_RAND_PART_B_STATE: - setupNoRandPartB(); - break; - case NO_RAND_PART_C_STATE: - setupNoRandPartC(); - break; - default: - break; + case START_BLOCK_STATE: + break; + case RAND_PART_A_STATE: + break; + case RAND_PART_B_STATE: + setupRandPartB(); + break; + case RAND_PART_C_STATE: + setupRandPartC(); + break; + case NO_RAND_PART_A_STATE: + break; + case NO_RAND_PART_B_STATE: + setupNoRandPartB(); + break; + case NO_RAND_PART_C_STATE: + setupNoRandPartC(); + break; + default: + break; } return retChar; } @@ -176,7 +178,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private void setDecompressStructureSizes( int newSize100k ) { if( !( 0 <= newSize100k && newSize100k <= 9 && 0 <= blockSize100k - && blockSize100k <= 9 ) ) + && blockSize100k <= 9 ) ) { // throw new IOException("Invalid block size"); } @@ -187,30 +189,30 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants return; int n = baseBlockSize * newSize100k; - ll8 = new char[n]; - tt = new int[n]; + ll8 = new char[ n ]; + tt = new int[ n ]; } private void setupBlock() { - int cftab[] = new int[257]; + int cftab[] = new int[ 257 ]; char ch; - cftab[0] = 0; + cftab[ 0 ] = 0; for( i = 1; i <= 256; i++ ) - cftab[i] = unzftab[i - 1]; + cftab[ i ] = unzftab[ i - 1 ]; for( i = 1; i <= 256; i++ ) - cftab[i] += cftab[i - 1]; + cftab[ i ] += cftab[ i - 1 ]; for( i = 0; i <= last; i++ ) { - ch = ( char )ll8[i]; - tt[cftab[ch]] = i; - cftab[ch]++; + ch = (char)ll8[ i ]; + tt[ cftab[ ch ] ] = i; + cftab[ ch ]++; } cftab = null; - tPos = tt[origPtr]; + tPos = tt[ origPtr ]; count = 0; i2 = 0; @@ -235,8 +237,8 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants if( i2 <= last ) { chPrev = ch2; - ch2 = ll8[tPos]; - tPos = tt[tPos]; + ch2 = ll8[ tPos ]; + tPos = tt[ tPos ]; i2++; currentChar = ch2; @@ -264,8 +266,8 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants count++; if( count >= 4 ) { - z = ll8[tPos]; - tPos = tt[tPos]; + z = ll8[ tPos ]; + tPos = tt[ tPos ]; currentState = NO_RAND_PART_C_STATE; j2 = 0; setupNoRandPartC(); @@ -280,7 +282,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private void setupNoRandPartC() { - if( j2 < ( int )z ) + if( j2 < (int)z ) { currentChar = ch2; mCrc.updateCRC( ch2 ); @@ -300,17 +302,17 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants if( i2 <= last ) { chPrev = ch2; - ch2 = ll8[tPos]; - tPos = tt[tPos]; + ch2 = ll8[ tPos ]; + tPos = tt[ tPos ]; if( rNToGo == 0 ) { - rNToGo = rNums[rTPos]; + rNToGo = rNums[ rTPos ]; rTPos++; if( rTPos == 512 ) rTPos = 0; } rNToGo--; - ch2 ^= ( int )( ( rNToGo == 1 ) ? 1 : 0 ); + ch2 ^= (int)( ( rNToGo == 1 ) ? 1 : 0 ); i2++; currentChar = ch2; @@ -338,11 +340,11 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants count++; if( count >= 4 ) { - z = ll8[tPos]; - tPos = tt[tPos]; + z = ll8[ tPos ]; + tPos = tt[ tPos ]; if( rNToGo == 0 ) { - rNToGo = rNums[rTPos]; + rNToGo = rNums[ rTPos ]; rTPos++; if( rTPos == 512 ) rTPos = 0; @@ -363,7 +365,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private void setupRandPartC() { - if( j2 < ( int )z ) + if( j2 < (int)z ) { currentChar = ch2; mCrc.updateCRC( ch2 ); @@ -380,7 +382,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private void getAndMoveToFrontDecode() { - char yy[] = new char[256]; + char yy[] = new char[ 256 ]; int i; int j; int nextSym; @@ -404,10 +406,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants * cache misses. */ for( i = 0; i <= 255; i++ ) - unzftab[i] = 0; + unzftab[ i ] = 0; for( i = 0; i <= 255; i++ ) - yy[i] = ( char )i; + yy[ i ] = (char)i; last = -1; { @@ -421,10 +423,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants groupPos = G_SIZE; } groupPos--; - zt = selector[groupNo]; - zn = minLens[zt]; + zt = selector[ groupNo ]; + zn = minLens[ zt ]; zvec = bsR( zn ); - while( zvec > limit[zt][zn] ) + while( zvec > limit[ zt ][ zn ] ) { zn++; { @@ -435,7 +437,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants char thech = 0; try { - thech = ( char )bsStream.read(); + thech = (char)bsStream.read(); } catch( IOException e ) { @@ -455,7 +457,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants } zvec = ( zvec << 1 ) | zj; } - nextSym = perm[zt][zvec - base[zt][zn]]; + nextSym = perm[ zt ][ zvec - base[ zt ][ zn ] ]; } while( true ) @@ -487,10 +489,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants groupPos = G_SIZE; } groupPos--; - zt = selector[groupNo]; - zn = minLens[zt]; + zt = selector[ groupNo ]; + zn = minLens[ zt ]; zvec = bsR( zn ); - while( zvec > limit[zt][zn] ) + while( zvec > limit[ zt ][ zn ] ) { zn++; { @@ -501,7 +503,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants char thech = 0; try { - thech = ( char )bsStream.read(); + thech = (char)bsStream.read(); } catch( IOException e ) { @@ -522,18 +524,18 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants zvec = ( zvec << 1 ) | zj; } ; - nextSym = perm[zt][zvec - base[zt][zn]]; + nextSym = perm[ zt ][ zvec - base[ zt ][ zn ] ]; } - }while ( nextSym == RUNA || nextSym == RUNB ); + } while( nextSym == RUNA || nextSym == RUNB ); s++; - ch = seqToUnseq[yy[0]]; - unzftab[ch] += s; + ch = seqToUnseq[ yy[ 0 ] ]; + unzftab[ ch ] += s; while( s > 0 ) { last++; - ll8[last] = ch; + ll8[ last ] = ch; s--; } ; @@ -549,9 +551,9 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants if( last >= limitLast ) blockOverrun(); - tmp = yy[nextSym - 1]; - unzftab[seqToUnseq[tmp]]++; - ll8[last] = seqToUnseq[tmp]; + tmp = yy[ nextSym - 1 ]; + unzftab[ seqToUnseq[ tmp ] ]++; + ll8[ last ] = seqToUnseq[ tmp ]; /* * This loop is hammered during decompression, @@ -561,15 +563,15 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants j = nextSym - 1; for( ; j > 3; j -= 4 ) { - yy[j] = yy[j - 1]; - yy[j - 1] = yy[j - 2]; - yy[j - 2] = yy[j - 3]; - yy[j - 3] = yy[j - 4]; + yy[ j ] = yy[ j - 1 ]; + yy[ j - 1 ] = yy[ j - 2 ]; + yy[ j - 2 ] = yy[ j - 3 ]; + yy[ j - 3 ] = yy[ j - 4 ]; } for( ; j > 0; j-- ) - yy[j] = yy[j - 1]; + yy[ j ] = yy[ j - 1 ]; - yy[0] = tmp; + yy[ 0 ] = tmp; { int zt; int zn; @@ -581,10 +583,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants groupPos = G_SIZE; } groupPos--; - zt = selector[groupNo]; - zn = minLens[zt]; + zt = selector[ groupNo ]; + zn = minLens[ zt ]; zvec = bsR( zn ); - while( zvec > limit[zt][zn] ) + while( zvec > limit[ zt ][ zn ] ) { zn++; { @@ -595,7 +597,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants char thech = 0; try { - thech = ( char )bsStream.read(); + thech = (char)bsStream.read(); } catch( IOException e ) { @@ -612,7 +614,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants zvec = ( zvec << 1 ) | zj; } ; - nextSym = perm[zt][zvec - base[zt][zn]]; + nextSym = perm[ zt ][ zvec - base[ zt ][ zn ] ]; } continue; } @@ -626,17 +628,17 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private int bsGetInt32() { - return ( int )bsGetint(); + return (int)bsGetint(); } private int bsGetIntVS( int numBits ) { - return ( int )bsR( numBits ); + return (int)bsR( numBits ); } private char bsGetUChar() { - return ( char )bsR( 8 ); + return (char)bsR( 8 ); } private int bsGetint() @@ -659,7 +661,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants char thech = 0; try { - thech = ( char )bsStream.read(); + thech = (char)bsStream.read(); } catch( IOException e ) { @@ -709,7 +711,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants crcError(); computedCombinedCRC = ( computedCombinedCRC << 1 ) - | ( computedCombinedCRC >>> 31 ); + | ( computedCombinedCRC >>> 31 ); computedCombinedCRC ^= computedBlockCRC; } @@ -725,33 +727,33 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants pp = 0; for( i = minLen; i <= maxLen; i++ ) for( j = 0; j < alphaSize; j++ ) - if( length[j] == i ) + if( length[ j ] == i ) { - perm[pp] = j; + perm[ pp ] = j; pp++; } ; for( i = 0; i < MAX_CODE_LEN; i++ ) - base[i] = 0; + base[ i ] = 0; for( i = 0; i < alphaSize; i++ ) - base[length[i] + 1]++; + base[ length[ i ] + 1 ]++; for( i = 1; i < MAX_CODE_LEN; i++ ) - base[i] += base[i - 1]; + base[ i ] += base[ i - 1 ]; for( i = 0; i < MAX_CODE_LEN; i++ ) - limit[i] = 0; + limit[ i ] = 0; vec = 0; for( i = minLen; i <= maxLen; i++ ) { - vec += ( base[i + 1] - base[i] ); - limit[i] = vec - 1; + vec += ( base[ i + 1 ] - base[ i ] ); + limit[ i ] = vec - 1; vec <<= 1; } for( i = minLen + 1; i <= maxLen; i++ ) - base[i] = ( ( limit[i - 1] + 1 ) << 1 ) - base[i]; + base[ i ] = ( ( limit[ i - 1 ] + 1 ) << 1 ) - base[ i ]; } private void initBlock() @@ -769,14 +771,14 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants magic5 = bsGetUChar(); magic6 = bsGetUChar(); if( magic1 == 0x17 && magic2 == 0x72 && magic3 == 0x45 - && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90 ) + && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90 ) { complete(); return; } if( magic1 != 0x31 || magic2 != 0x41 || magic3 != 0x59 - || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59 ) + || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59 ) { badBlockHeader(); streamEnd = true; @@ -819,17 +821,17 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants int i; nInUse = 0; for( i = 0; i < 256; i++ ) - if( inUse[i] ) + if( inUse[ i ] ) { - seqToUnseq[nInUse] = ( char )i; - unseqToSeq[i] = ( char )nInUse; + seqToUnseq[ nInUse ] = (char)i; + unseqToSeq[ i ] = (char)nInUse; nInUse++; } } private void recvDecodingTables() { - char len[][] = new char[N_GROUPS][MAX_ALPHA_SIZE]; + char len[][] = new char[ N_GROUPS ][ MAX_ALPHA_SIZE ]; int i; int j; int t; @@ -838,25 +840,25 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants int alphaSize; int minLen; int maxLen; - boolean inUse16[] = new boolean[16]; + boolean inUse16[] = new boolean[ 16 ]; /* * Receive the mapping table */ for( i = 0; i < 16; i++ ) if( bsR( 1 ) == 1 ) - inUse16[i] = true; + inUse16[ i ] = true; else - inUse16[i] = false; + inUse16[ i ] = false; for( i = 0; i < 256; i++ ) - inUse[i] = false; + inUse[ i ] = false; for( i = 0; i < 16; i++ ) - if( inUse16[i] ) + if( inUse16[ i ] ) for( j = 0; j < 16; j++ ) if( bsR( 1 ) == 1 ) - inUse[i * 16 + j] = true; + inUse[ i * 16 + j ] = true; makeMaps(); alphaSize = nInUse + 2; @@ -871,29 +873,29 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants j = 0; while( bsR( 1 ) == 1 ) j++; - selectorMtf[i] = ( char )j; + selectorMtf[ i ] = (char)j; } { /* * Undo the MTF values for the selectors. */ - char pos[] = new char[N_GROUPS]; + char pos[] = new char[ N_GROUPS ]; char tmp; char v; for( v = 0; v < nGroups; v++ ) - pos[v] = v; + pos[ v ] = v; for( i = 0; i < nSelectors; i++ ) { - v = selectorMtf[i]; - tmp = pos[v]; + v = selectorMtf[ i ]; + tmp = pos[ v ]; while( v > 0 ) { - pos[v] = pos[v - 1]; + pos[ v ] = pos[ v - 1 ]; v--; } - pos[0] = tmp; - selector[i] = tmp; + pos[ 0 ] = tmp; + selector[ i ] = tmp; } } @@ -912,7 +914,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants else curr--; } - len[t][i] = ( char )curr; + len[ t ][ i ] = (char)curr; } } @@ -925,14 +927,14 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants maxLen = 0; for( i = 0; i < alphaSize; i++ ) { - if( len[t][i] > maxLen ) - maxLen = len[t][i]; - if( len[t][i] < minLen ) - minLen = len[t][i]; + if( len[ t ][ i ] > maxLen ) + maxLen = len[ t ][ i ]; + if( len[ t ][ i ] < minLen ) + minLen = len[ t ][ i ]; } - hbCreateDecodeTables( limit[t], base[t], perm[t], len[t], minLen, - maxLen, alphaSize ); - minLens[t] = minLen; + hbCreateDecodeTables( limit[ t ], base[ t ], perm[ t ], len[ t ], minLen, + maxLen, alphaSize ); + minLens[ t ] = minLen; } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java b/proposal/myrmidon/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java index 7ee53781c..83e7e4473 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java +++ b/proposal/myrmidon/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java @@ -6,7 +6,9 @@ * the LICENSE file. */ package org.apache.tools.bzip2; -import java.io.*; + +import java.io.IOException; +import java.io.OutputStream; /** * An output stream that compresses into the BZip2 format (without the file @@ -35,15 +37,15 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants protected final static int QSORT_STACK_SIZE = 1000; CRC mCrc = new CRC(); - private boolean inUse[] = new boolean[256]; + private boolean inUse[] = new boolean[ 256 ]; - private char seqToUnseq[] = new char[256]; - private char unseqToSeq[] = new char[256]; + private char seqToUnseq[] = new char[ 256 ]; + private char unseqToSeq[] = new char[ 256 ]; - private char selector[] = new char[MAX_SELECTORS]; - private char selectorMtf[] = new char[MAX_SELECTORS]; + private char selector[] = new char[ MAX_SELECTORS ]; + private char selectorMtf[] = new char[ MAX_SELECTORS ]; - private int mtfFreq[] = new int[MAX_ALPHA_SIZE]; + private int mtfFreq[] = new int[ MAX_ALPHA_SIZE ]; private int currentChar = -1; private int runLength = 0; @@ -57,8 +59,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants * usually small, typically <= 20. */ private int incs[] = {1, 4, 13, 40, 121, 364, 1093, 3280, - 9841, 29524, 88573, 265720, - 797161, 2391484}; + 9841, 29524, 88573, 265720, + 797161, 2391484}; boolean blockRandomised; @@ -181,38 +183,38 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants int k; boolean tooLong; - int heap[] = new int[MAX_ALPHA_SIZE + 2]; - int weight[] = new int[MAX_ALPHA_SIZE * 2]; - int parent[] = new int[MAX_ALPHA_SIZE * 2]; + int heap[] = new int[ MAX_ALPHA_SIZE + 2 ]; + int weight[] = new int[ MAX_ALPHA_SIZE * 2 ]; + int parent[] = new int[ MAX_ALPHA_SIZE * 2 ]; for( i = 0; i < alphaSize; i++ ) - weight[i + 1] = ( freq[i] == 0 ? 1 : freq[i] ) << 8; + weight[ i + 1 ] = ( freq[ i ] == 0 ? 1 : freq[ i ] ) << 8; while( true ) { nNodes = alphaSize; nHeap = 0; - heap[0] = 0; - weight[0] = 0; - parent[0] = -2; + heap[ 0 ] = 0; + weight[ 0 ] = 0; + parent[ 0 ] = -2; for( i = 1; i <= alphaSize; i++ ) { - parent[i] = -1; + parent[ i ] = -1; nHeap++; - heap[nHeap] = i; + heap[ nHeap ] = i; { int zz; int tmp; zz = nHeap; - tmp = heap[zz]; - while( weight[tmp] < weight[heap[zz >> 1]] ) + tmp = heap[ zz ]; + while( weight[ tmp ] < weight[ heap[ zz >> 1 ] ] ) { - heap[zz] = heap[zz >> 1]; + heap[ zz ] = heap[ zz >> 1 ]; zz >>= 1; } - heap[zz] = tmp; + heap[ zz ] = tmp; } } if( !( nHeap < ( MAX_ALPHA_SIZE + 2 ) ) ) @@ -220,78 +222,78 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants while( nHeap > 1 ) { - n1 = heap[1]; - heap[1] = heap[nHeap]; + n1 = heap[ 1 ]; + heap[ 1 ] = heap[ nHeap ]; nHeap--; { int zz = 0; int yy = 0; int tmp = 0; zz = 1; - tmp = heap[zz]; + tmp = heap[ zz ]; while( true ) { yy = zz << 1; if( yy > nHeap ) break; if( yy < nHeap && - weight[heap[yy + 1]] < weight[heap[yy]] ) + weight[ heap[ yy + 1 ] ] < weight[ heap[ yy ] ] ) yy++; - if( weight[tmp] < weight[heap[yy]] ) + if( weight[ tmp ] < weight[ heap[ yy ] ] ) break; - heap[zz] = heap[yy]; + heap[ zz ] = heap[ yy ]; zz = yy; } - heap[zz] = tmp; + heap[ zz ] = tmp; } - n2 = heap[1]; - heap[1] = heap[nHeap]; + n2 = heap[ 1 ]; + heap[ 1 ] = heap[ nHeap ]; nHeap--; { int zz = 0; int yy = 0; int tmp = 0; zz = 1; - tmp = heap[zz]; + tmp = heap[ zz ]; while( true ) { yy = zz << 1; if( yy > nHeap ) break; if( yy < nHeap && - weight[heap[yy + 1]] < weight[heap[yy]] ) + weight[ heap[ yy + 1 ] ] < weight[ heap[ yy ] ] ) yy++; - if( weight[tmp] < weight[heap[yy]] ) + if( weight[ tmp ] < weight[ heap[ yy ] ] ) break; - heap[zz] = heap[yy]; + heap[ zz ] = heap[ yy ]; zz = yy; } - heap[zz] = tmp; + heap[ zz ] = tmp; } nNodes++; - parent[n1] = parent[n2] = nNodes; + parent[ n1 ] = parent[ n2 ] = nNodes; - weight[nNodes] = ( ( weight[n1] & 0xffffff00 ) - + ( weight[n2] & 0xffffff00 ) ) - | ( 1 + ( ( ( weight[n1] & 0x000000ff ) > - ( weight[n2] & 0x000000ff ) ) ? - ( weight[n1] & 0x000000ff ) : - ( weight[n2] & 0x000000ff ) ) ); + weight[ nNodes ] = ( ( weight[ n1 ] & 0xffffff00 ) + + ( weight[ n2 ] & 0xffffff00 ) ) + | ( 1 + ( ( ( weight[ n1 ] & 0x000000ff ) > + ( weight[ n2 ] & 0x000000ff ) ) ? + ( weight[ n1 ] & 0x000000ff ) : + ( weight[ n2 ] & 0x000000ff ) ) ); - parent[nNodes] = -1; + parent[ nNodes ] = -1; nHeap++; - heap[nHeap] = nNodes; + heap[ nHeap ] = nNodes; { int zz = 0; int tmp = 0; zz = nHeap; - tmp = heap[zz]; - while( weight[tmp] < weight[heap[zz >> 1]] ) + tmp = heap[ zz ]; + while( weight[ tmp ] < weight[ heap[ zz >> 1 ] ] ) { - heap[zz] = heap[zz >> 1]; + heap[ zz ] = heap[ zz >> 1 ]; zz >>= 1; } - heap[zz] = tmp; + heap[ zz ] = tmp; } } if( !( nNodes < ( MAX_ALPHA_SIZE * 2 ) ) ) @@ -302,12 +304,12 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants { j = 0; k = i; - while( parent[k] >= 0 ) + while( parent[ k ] >= 0 ) { - k = parent[k]; + k = parent[ k ]; j++; } - len[i - 1] = ( char )j; + len[ i - 1 ] = (char)j; if( j > maxLen ) tooLong = true; } @@ -317,9 +319,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants for( i = 1; i < alphaSize; i++ ) { - j = weight[i] >> 8; + j = weight[ i ] >> 8; j = 1 + ( j / 2 ); - weight[i] = j << 8; + weight[ i ] = j << 8; } } } @@ -398,13 +400,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants private void allocateCompressStructures() { int n = baseBlockSize * blockSize100k; - block = new char[( n + 1 + NUM_OVERSHOOT_BYTES )]; - quadrant = new int[( n + NUM_OVERSHOOT_BYTES )]; - zptr = new int[n]; - ftab = new int[65537]; + block = new char[ ( n + 1 + NUM_OVERSHOOT_BYTES ) ]; + quadrant = new int[ ( n + NUM_OVERSHOOT_BYTES ) ]; + zptr = new int[ n ]; + ftab = new int[ 65537 ]; if( block == null || quadrant == null || zptr == null - || ftab == null ) + || ftab == null ) { //int totalDraw = (n + 1 + NUM_OVERSHOOT_BYTES) + (n + NUM_OVERSHOOT_BYTES) + n + 65537; //compressOutOfMemory ( totalDraw, n ); @@ -422,7 +424,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants */ // szptr = zptr; - szptr = new short[2 * n]; + szptr = new short[ 2 * n ]; } private void bsFinishedWithStream() @@ -519,7 +521,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants origPtr = -1; for( i = 0; i <= last; i++ ) - if( zptr[i] == 0 ) + if( zptr[ i ] == 0 ) { origPtr = i; break; @@ -616,43 +618,43 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants int s1; int s2; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; @@ -662,45 +664,45 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants do { - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); - s1 = quadrant[i1]; - s2 = quadrant[i2]; + s1 = quadrant[ i1 ]; + s2 = quadrant[ i2 ]; if( s1 != s2 ) return ( s1 > s2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); - s1 = quadrant[i1]; - s2 = quadrant[i2]; + s1 = quadrant[ i1 ]; + s2 = quadrant[ i2 ]; if( s1 != s2 ) return ( s1 > s2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); - s1 = quadrant[i1]; - s2 = quadrant[i2]; + s1 = quadrant[ i1 ]; + s2 = quadrant[ i2 ]; if( s1 != s2 ) return ( s1 > s2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); - s1 = quadrant[i1]; - s2 = quadrant[i2]; + s1 = quadrant[ i1 ]; + s2 = quadrant[ i2 ]; if( s1 != s2 ) return ( s1 > s2 ); i1++; @@ -721,14 +723,14 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants k -= 4; workDone++; - }while ( k >= 0 ); + } while( k >= 0 ); return false; } private void generateMTFValues() { - char yy[] = new char[256]; + char yy[] = new char[ 256 ]; int i; int j; char tmp; @@ -741,30 +743,30 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants EOB = nInUse + 1; for( i = 0; i <= EOB; i++ ) - mtfFreq[i] = 0; + mtfFreq[ i ] = 0; wr = 0; zPend = 0; for( i = 0; i < nInUse; i++ ) - yy[i] = ( char )i; + yy[ i ] = (char)i; for( i = 0; i <= last; i++ ) { char ll_i; - ll_i = unseqToSeq[block[zptr[i]]]; + ll_i = unseqToSeq[ block[ zptr[ i ] ] ]; j = 0; - tmp = yy[j]; + tmp = yy[ j ]; while( ll_i != tmp ) { j++; tmp2 = tmp; - tmp = yy[j]; - yy[j] = tmp2; + tmp = yy[ j ]; + yy[ j ] = tmp2; } ; - yy[0] = tmp; + yy[ 0 ] = tmp; if( j == 0 ) { @@ -777,18 +779,18 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants zPend--; while( true ) { - switch ( zPend % 2 ) + switch( zPend % 2 ) { - case 0: - szptr[wr] = ( short )RUNA; - wr++; - mtfFreq[RUNA]++; - break; - case 1: - szptr[wr] = ( short )RUNB; - wr++; - mtfFreq[RUNB]++; - break; + case 0: + szptr[ wr ] = (short)RUNA; + wr++; + mtfFreq[ RUNA ]++; + break; + case 1: + szptr[ wr ] = (short)RUNB; + wr++; + mtfFreq[ RUNB ]++; + break; } ; if( zPend < 2 ) @@ -798,9 +800,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants ; zPend = 0; } - szptr[wr] = ( short )( j + 1 ); + szptr[ wr ] = (short)( j + 1 ); wr++; - mtfFreq[j + 1]++; + mtfFreq[ j + 1 ]++; } } @@ -809,18 +811,18 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants zPend--; while( true ) { - switch ( zPend % 2 ) + switch( zPend % 2 ) { - case 0: - szptr[wr] = ( short )RUNA; - wr++; - mtfFreq[RUNA]++; - break; - case 1: - szptr[wr] = ( short )RUNB; - wr++; - mtfFreq[RUNB]++; - break; + case 0: + szptr[ wr ] = (short)RUNA; + wr++; + mtfFreq[ RUNA ]++; + break; + case 1: + szptr[ wr ] = (short)RUNB; + wr++; + mtfFreq[ RUNB ]++; + break; } if( zPend < 2 ) break; @@ -828,9 +830,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants } } - szptr[wr] = ( short )EOB; + szptr[ wr ] = (short)EOB; wr++; - mtfFreq[EOB]++; + mtfFreq[ EOB ]++; nMTF = wr; } @@ -846,9 +848,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants for( n = minLen; n <= maxLen; n++ ) { for( i = 0; i < alphaSize; i++ ) - if( length[i] == n ) + if( length[ i ] == n ) { - code[i] = vec; + code[ i ] = vec; vec++; } ; @@ -864,7 +866,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants // ch = 0; for( int i = 0; i < 256; i++ ) - inUse[i] = false; + inUse[ i ] = false; /* * 20 is just a paranoia constant @@ -895,9 +897,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants int j; int ss; int sb; - int runningOrder[] = new int[256]; - int copy[] = new int[256]; - boolean bigDone[] = new boolean[256]; + int runningOrder[] = new int[ 256 ]; + int copy[] = new int[ 256 ]; + boolean bigDone[] = new boolean[ 256 ]; int c1; int c2; int numQSorted; @@ -909,11 +911,11 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants */ // if (verbosity >= 4) fprintf ( stderr, " sort initialise ...\n" ); for( i = 0; i < NUM_OVERSHOOT_BYTES; i++ ) - block[last + i + 2] = block[( i % ( last + 1 ) ) + 1]; + block[ last + i + 2 ] = block[ ( i % ( last + 1 ) ) + 1 ]; for( i = 0; i <= last + NUM_OVERSHOOT_BYTES; i++ ) - quadrant[i] = 0; + quadrant[ i ] = 0; - block[0] = ( char )( block[last + 1] ); + block[ 0 ] = (char)( block[ last + 1 ] ); if( last < 4000 ) { @@ -922,7 +924,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants * has quite a large constant overhead. */ for( i = 0; i <= last; i++ ) - zptr[i] = i; + zptr[ i ] = i; firstAttempt = false; workDone = workLimit = 0; simpleSort( 0, last, 0 ); @@ -931,35 +933,35 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants { numQSorted = 0; for( i = 0; i <= 255; i++ ) - bigDone[i] = false; + bigDone[ i ] = false; for( i = 0; i <= 65536; i++ ) - ftab[i] = 0; + ftab[ i ] = 0; - c1 = block[0]; + c1 = block[ 0 ]; for( i = 0; i <= last; i++ ) { - c2 = block[i + 1]; - ftab[( c1 << 8 ) + c2]++; + c2 = block[ i + 1 ]; + ftab[ ( c1 << 8 ) + c2 ]++; c1 = c2; } for( i = 1; i <= 65536; i++ ) - ftab[i] += ftab[i - 1]; + ftab[ i ] += ftab[ i - 1 ]; - c1 = block[1]; + c1 = block[ 1 ]; for( i = 0; i < last; i++ ) { - c2 = block[i + 2]; + c2 = block[ i + 2 ]; j = ( c1 << 8 ) + c2; c1 = c2; - ftab[j]--; - zptr[ftab[j]] = i; + ftab[ j ]--; + zptr[ ftab[ j ] ] = i; } - j = ( ( block[last + 1] ) << 8 ) + ( block[1] ); - ftab[j]--; - zptr[ftab[j]] = last; + j = ( ( block[ last + 1 ] ) << 8 ) + ( block[ 1 ] ); + ftab[ j ]--; + zptr[ ftab[ j ] ] = last; /* * Now ftab contains the first loc of every small bucket. @@ -967,32 +969,32 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants * big bucket. */ for( i = 0; i <= 255; i++ ) - runningOrder[i] = i; + runningOrder[ i ] = i; { int vv; int h = 1; do h = 3 * h + 1; -while ( h <= 256 ); + while( h <= 256 ); do { h = h / 3; for( i = h; i <= 255; i++ ) { - vv = runningOrder[i]; + vv = runningOrder[ i ]; j = i; - while( ( ftab[( ( runningOrder[j - h] ) + 1 ) << 8] - - ftab[( runningOrder[j - h] ) << 8] ) > - ( ftab[( ( vv ) + 1 ) << 8] - ftab[( vv ) << 8] ) ) + while( ( ftab[ ( ( runningOrder[ j - h ] ) + 1 ) << 8 ] + - ftab[ ( runningOrder[ j - h ] ) << 8 ] ) > + ( ftab[ ( ( vv ) + 1 ) << 8 ] - ftab[ ( vv ) << 8 ] ) ) { - runningOrder[j] = runningOrder[j - h]; + runningOrder[ j ] = runningOrder[ j - h ]; j = j - h; if( j <= ( h - 1 ) ) break; } - runningOrder[j] = vv; + runningOrder[ j ] = vv; } - }while ( h != 1 ); + } while( h != 1 ); } /* @@ -1004,7 +1006,7 @@ while ( h <= 256 ); /* * Process big buckets, starting with the least full. */ - ss = runningOrder[i]; + ss = runningOrder[ i ]; /* * Complete the big bucket [ss] by quicksorting @@ -1016,10 +1018,10 @@ while ( h <= 256 ); for( j = 0; j <= 255; j++ ) { sb = ( ss << 8 ) + j; - if( !( ( ftab[sb] & SETMASK ) == SETMASK ) ) + if( !( ( ftab[ sb ] & SETMASK ) == SETMASK ) ) { - int lo = ftab[sb] & CLEARMASK; - int hi = ( ftab[sb + 1] & CLEARMASK ) - 1; + int lo = ftab[ sb ] & CLEARMASK; + int hi = ( ftab[ sb + 1 ] & CLEARMASK ) - 1; if( hi > lo ) { qSort3( lo, hi, 2 ); @@ -1027,7 +1029,7 @@ while ( h <= 256 ); if( workDone > workLimit && firstAttempt ) return; } - ftab[sb] |= SETMASK; + ftab[ sb ] |= SETMASK; } } @@ -1039,12 +1041,12 @@ while ( h <= 256 ); * this updating for the last bucket processed, since * updating for the last bucket is pointless. */ - bigDone[ss] = true; + bigDone[ ss ] = true; if( i < 255 ) { - int bbStart = ftab[ss << 8] & CLEARMASK; - int bbSize = ( ftab[( ss + 1 ) << 8] & CLEARMASK ) - bbStart; + int bbStart = ftab[ ss << 8 ] & CLEARMASK; + int bbSize = ( ftab[ ( ss + 1 ) << 8 ] & CLEARMASK ) - bbStart; int shifts = 0; while( ( bbSize >> shifts ) > 65534 ) @@ -1052,11 +1054,11 @@ while ( h <= 256 ); for( j = 0; j < bbSize; j++ ) { - int a2update = zptr[bbStart + j]; + int a2update = zptr[ bbStart + j ]; int qVal = ( j >> shifts ); - quadrant[a2update] = qVal; + quadrant[ a2update ] = qVal; if( a2update < NUM_OVERSHOOT_BYTES ) - quadrant[a2update + last + 1] = qVal; + quadrant[ a2update + last + 1 ] = qVal; } if( !( ( ( bbSize - 1 ) >> shifts ) <= 65535 ) ) @@ -1068,21 +1070,21 @@ while ( h <= 256 ); * sorted order for small buckets [t, ss] for all t != ss. */ for( j = 0; j <= 255; j++ ) - copy[j] = ftab[( j << 8 ) + ss] & CLEARMASK; + copy[ j ] = ftab[ ( j << 8 ) + ss ] & CLEARMASK; - for( j = ftab[ss << 8] & CLEARMASK; - j < ( ftab[( ss + 1 ) << 8] & CLEARMASK ); j++ ) + for( j = ftab[ ss << 8 ] & CLEARMASK; + j < ( ftab[ ( ss + 1 ) << 8 ] & CLEARMASK ); j++ ) { - c1 = block[zptr[j]]; - if( !bigDone[c1] ) + c1 = block[ zptr[ j ] ]; + if( !bigDone[ c1 ] ) { - zptr[copy[c1]] = zptr[j] == 0 ? last : zptr[j] - 1; - copy[c1]++; + zptr[ copy[ c1 ] ] = zptr[ j ] == 0 ? last : zptr[ j ] - 1; + copy[ c1 ]++; } } for( j = 0; j <= 255; j++ ) - ftab[( j << 8 ) + ss] |= SETMASK; + ftab[ ( j << 8 ) + ss ] |= SETMASK; } } } @@ -1092,10 +1094,10 @@ while ( h <= 256 ); int i; nInUse = 0; for( i = 0; i < 256; i++ ) - if( inUse[i] ) + if( inUse[ i ] ) { - seqToUnseq[nInUse] = ( char )i; - unseqToSeq[i] = ( char )nInUse; + seqToUnseq[ nInUse ] = (char)i; + unseqToSeq[ i ] = (char)nInUse; nInUse++; } } @@ -1141,15 +1143,15 @@ while ( h <= 256 ); int lo; int hi; int d; - StackElem[] stack = new StackElem[QSORT_STACK_SIZE]; + StackElem[] stack = new StackElem[ QSORT_STACK_SIZE ]; for( int count = 0; count < QSORT_STACK_SIZE; count++ ) - stack[count] = new StackElem(); + stack[ count ] = new StackElem(); sp = 0; - stack[sp].ll = loSt; - stack[sp].hh = hiSt; - stack[sp].dd = dSt; + stack[ sp ].ll = loSt; + stack[ sp ].hh = hiSt; + stack[ sp ].dd = dSt; sp++; while( sp > 0 ) @@ -1158,9 +1160,9 @@ while ( h <= 256 ); panic(); sp--; - lo = stack[sp].ll; - hi = stack[sp].hh; - d = stack[sp].dd; + lo = stack[ sp ].ll; + hi = stack[ sp ].hh; + d = stack[ sp ].dd; if( hi - lo < SMALL_THRESH || d > DEPTH_THRESH ) { @@ -1170,9 +1172,9 @@ while ( h <= 256 ); continue; } - med = med3( block[zptr[lo] + d + 1], - block[zptr[hi] + d + 1], - block[zptr[( lo + hi ) >> 1] + d + 1] ); + med = med3( block[ zptr[ lo ] + d + 1 ], + block[ zptr[ hi ] + d + 1 ], + block[ zptr[ ( lo + hi ) >> 1 ] + d + 1 ] ); unLo = ltLo = lo; unHi = gtHi = hi; @@ -1183,13 +1185,13 @@ while ( h <= 256 ); { if( unLo > unHi ) break; - n = ( ( int )block[zptr[unLo] + d + 1] ) - med; + n = ( (int)block[ zptr[ unLo ] + d + 1 ] ) - med; if( n == 0 ) { int temp = 0; - temp = zptr[unLo]; - zptr[unLo] = zptr[ltLo]; - zptr[ltLo] = temp; + temp = zptr[ unLo ]; + zptr[ unLo ] = zptr[ ltLo ]; + zptr[ ltLo ] = temp; ltLo++; unLo++; continue; @@ -1203,13 +1205,13 @@ while ( h <= 256 ); { if( unLo > unHi ) break; - n = ( ( int )block[zptr[unHi] + d + 1] ) - med; + n = ( (int)block[ zptr[ unHi ] + d + 1 ] ) - med; if( n == 0 ) { int temp = 0; - temp = zptr[unHi]; - zptr[unHi] = zptr[gtHi]; - zptr[gtHi] = temp; + temp = zptr[ unHi ]; + zptr[ unHi ] = zptr[ gtHi ]; + zptr[ gtHi ] = temp; gtHi--; unHi--; continue; @@ -1222,18 +1224,18 @@ while ( h <= 256 ); if( unLo > unHi ) break; int temp = 0; - temp = zptr[unLo]; - zptr[unLo] = zptr[unHi]; - zptr[unHi] = temp; + temp = zptr[ unLo ]; + zptr[ unLo ] = zptr[ unHi ]; + zptr[ unHi ] = temp; unLo++; unHi--; } if( gtHi < ltLo ) { - stack[sp].ll = lo; - stack[sp].hh = hi; - stack[sp].dd = d + 1; + stack[ sp ].ll = lo; + stack[ sp ].hh = hi; + stack[ sp ].dd = d + 1; sp++; continue; } @@ -1246,19 +1248,19 @@ while ( h <= 256 ); n = lo + unLo - ltLo - 1; m = hi - ( gtHi - unHi ) + 1; - stack[sp].ll = lo; - stack[sp].hh = n; - stack[sp].dd = d; + stack[ sp ].ll = lo; + stack[ sp ].hh = n; + stack[ sp ].dd = d; sp++; - stack[sp].ll = n + 1; - stack[sp].hh = m - 1; - stack[sp].dd = d + 1; + stack[ sp ].ll = n + 1; + stack[ sp ].hh = m - 1; + stack[ sp ].dd = d + 1; sp++; - stack[sp].ll = m; - stack[sp].hh = hi; - stack[sp].dd = d; + stack[ sp ].ll = m; + stack[ sp ].hh = hi; + stack[ sp ].dd = d; sp++; } } @@ -1269,30 +1271,30 @@ while ( h <= 256 ); int rNToGo = 0; int rTPos = 0; for( i = 0; i < 256; i++ ) - inUse[i] = false; + inUse[ i ] = false; for( i = 0; i <= last; i++ ) { if( rNToGo == 0 ) { - rNToGo = ( char )rNums[rTPos]; + rNToGo = (char)rNums[ rTPos ]; rTPos++; if( rTPos == 512 ) rTPos = 0; } rNToGo--; - block[i + 1] ^= ( ( rNToGo == 1 ) ? 1 : 0 ); + block[ i + 1 ] ^= ( ( rNToGo == 1 ) ? 1 : 0 ); // handle 16 bit signed numbers - block[i + 1] &= 0xFF; + block[ i + 1 ] &= 0xFF; - inUse[block[i + 1]] = true; + inUse[ block[ i + 1 ] ] = true; } } private void sendMTFValues() throws IOException { - char len[][] = new char[N_GROUPS][MAX_ALPHA_SIZE]; + char len[][] = new char[ N_GROUPS ][ MAX_ALPHA_SIZE ]; int v; @@ -1324,7 +1326,7 @@ while ( h <= 256 ); alphaSize = nInUse + 2; for( t = 0; t < N_GROUPS; t++ ) for( v = 0; v < alphaSize; v++ ) - len[t][v] = ( char )GREATER_ICOST; + len[ t ][ v ] = (char)GREATER_ICOST; /* * Decide how many coding tables to use @@ -1362,21 +1364,21 @@ while ( h <= 256 ); while( aFreq < tFreq && ge < alphaSize - 1 ) { ge++; - aFreq += mtfFreq[ge]; + aFreq += mtfFreq[ ge ]; } if( ge > gs && nPart != nGroups && nPart != 1 - && ( ( nGroups - nPart ) % 2 == 1 ) ) + && ( ( nGroups - nPart ) % 2 == 1 ) ) { - aFreq -= mtfFreq[ge]; + aFreq -= mtfFreq[ ge ]; ge--; } for( v = 0; v < alphaSize; v++ ) if( v >= gs && v <= ge ) - len[nPart - 1][v] = ( char )LESSER_ICOST; + len[ nPart - 1 ][ v ] = (char)LESSER_ICOST; else - len[nPart - 1][v] = ( char )GREATER_ICOST; + len[ nPart - 1 ][ v ] = (char)GREATER_ICOST; nPart--; gs = ge + 1; @@ -1384,20 +1386,20 @@ while ( h <= 256 ); } } - int rfreq[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; - int fave[] = new int[N_GROUPS]; - short cost[] = new short[N_GROUPS]; + int rfreq[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; + int fave[] = new int[ N_GROUPS ]; + short cost[] = new short[ N_GROUPS ]; /* * Iterate up to N_ITERS times to improve the tables. */ for( iter = 0; iter < N_ITERS; iter++ ) { for( t = 0; t < nGroups; t++ ) - fave[t] = 0; + fave[ t ] = 0; for( t = 0; t < nGroups; t++ ) for( v = 0; v < alphaSize; v++ ) - rfreq[t][v] = 0; + rfreq[ t ][ v ] = 0; nSelectors = 0; totc = 0; @@ -1419,7 +1421,7 @@ while ( h <= 256 ); * by each of the coding tables. */ for( t = 0; t < nGroups; t++ ) - cost[t] = 0; + cost[ t ] = 0; if( nGroups == 6 ) { @@ -1432,28 +1434,28 @@ while ( h <= 256 ); cost0 = cost1 = cost2 = cost3 = cost4 = cost5 = 0; for( i = gs; i <= ge; i++ ) { - short icv = szptr[i]; - cost0 += len[0][icv]; - cost1 += len[1][icv]; - cost2 += len[2][icv]; - cost3 += len[3][icv]; - cost4 += len[4][icv]; - cost5 += len[5][icv]; + short icv = szptr[ i ]; + cost0 += len[ 0 ][ icv ]; + cost1 += len[ 1 ][ icv ]; + cost2 += len[ 2 ][ icv ]; + cost3 += len[ 3 ][ icv ]; + cost4 += len[ 4 ][ icv ]; + cost5 += len[ 5 ][ icv ]; } - cost[0] = cost0; - cost[1] = cost1; - cost[2] = cost2; - cost[3] = cost3; - cost[4] = cost4; - cost[5] = cost5; + cost[ 0 ] = cost0; + cost[ 1 ] = cost1; + cost[ 2 ] = cost2; + cost[ 3 ] = cost3; + cost[ 4 ] = cost4; + cost[ 5 ] = cost5; } else { for( i = gs; i <= ge; i++ ) { - short icv = szptr[i]; + short icv = szptr[ i ]; for( t = 0; t < nGroups; t++ ) - cost[t] += len[t][icv]; + cost[ t ] += len[ t ][ icv ]; } } @@ -1464,22 +1466,22 @@ while ( h <= 256 ); bc = 999999999; bt = -1; for( t = 0; t < nGroups; t++ ) - if( cost[t] < bc ) + if( cost[ t ] < bc ) { - bc = cost[t]; + bc = cost[ t ]; bt = t; } ; totc += bc; - fave[bt]++; - selector[nSelectors] = ( char )bt; + fave[ bt ]++; + selector[ nSelectors ] = (char)bt; nSelectors++; /* * Increment the symbol frequencies for the selected table. */ for( i = gs; i <= ge; i++ ) - rfreq[bt][szptr[i]]++; + rfreq[ bt ][ szptr[ i ] ]++; gs = ge + 1; } @@ -1488,7 +1490,7 @@ while ( h <= 256 ); * Recompute the tables based on the accumulated frequencies. */ for( t = 0; t < nGroups; t++ ) - hbMakeCodeLengths( len[t], rfreq[t], alphaSize, 20 ); + hbMakeCodeLengths( len[ t ], rfreq[ t ], alphaSize, 20 ); } rfreq = null; @@ -1503,30 +1505,30 @@ while ( h <= 256 ); /* * Compute MTF values for the selectors. */ - char pos[] = new char[N_GROUPS]; + char pos[] = new char[ N_GROUPS ]; char ll_i; char tmp2; char tmp; for( i = 0; i < nGroups; i++ ) - pos[i] = ( char )i; + pos[ i ] = (char)i; for( i = 0; i < nSelectors; i++ ) { - ll_i = selector[i]; + ll_i = selector[ i ]; j = 0; - tmp = pos[j]; + tmp = pos[ j ]; while( ll_i != tmp ) { j++; tmp2 = tmp; - tmp = pos[j]; - pos[j] = tmp2; + tmp = pos[ j ]; + pos[ j ] = tmp2; } - pos[0] = tmp; - selectorMtf[i] = ( char )j; + pos[ 0 ] = tmp; + selectorMtf[ i ] = (char)j; } } - int code[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; + int code[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; /* * Assign actual codes for the tables. @@ -1537,41 +1539,41 @@ while ( h <= 256 ); maxLen = 0; for( i = 0; i < alphaSize; i++ ) { - if( len[t][i] > maxLen ) - maxLen = len[t][i]; - if( len[t][i] < minLen ) - minLen = len[t][i]; + if( len[ t ][ i ] > maxLen ) + maxLen = len[ t ][ i ]; + if( len[ t ][ i ] < minLen ) + minLen = len[ t ][ i ]; } if( maxLen > 20 ) panic(); if( minLen < 1 ) panic(); - hbAssignCodes( code[t], len[t], minLen, maxLen, alphaSize ); + hbAssignCodes( code[ t ], len[ t ], minLen, maxLen, alphaSize ); } { /* * Transmit the mapping table. */ - boolean inUse16[] = new boolean[16]; + boolean inUse16[] = new boolean[ 16 ]; for( i = 0; i < 16; i++ ) { - inUse16[i] = false; + inUse16[ i ] = false; for( j = 0; j < 16; j++ ) - if( inUse[i * 16 + j] ) - inUse16[i] = true; + if( inUse[ i * 16 + j ] ) + inUse16[ i ] = true; } nBytes = bytesOut; for( i = 0; i < 16; i++ ) - if( inUse16[i] ) + if( inUse16[ i ] ) bsW( 1, 1 ); else bsW( 1, 0 ); for( i = 0; i < 16; i++ ) - if( inUse16[i] ) + if( inUse16[ i ] ) for( j = 0; j < 16; j++ ) - if( inUse[i * 16 + j] ) + if( inUse[ i * 16 + j ] ) bsW( 1, 1 ); else bsW( 1, 0 ); @@ -1586,7 +1588,7 @@ while ( h <= 256 ); bsW( 15, nSelectors ); for( i = 0; i < nSelectors; i++ ) { - for( j = 0; j < selectorMtf[i]; j++ ) + for( j = 0; j < selectorMtf[ i ]; j++ ) bsW( 1, 1 ); bsW( 1, 0 ); } @@ -1598,11 +1600,11 @@ while ( h <= 256 ); for( t = 0; t < nGroups; t++ ) { - int curr = len[t][0]; + int curr = len[ t ][ 0 ]; bsW( 5, curr ); for( i = 0; i < alphaSize; i++ ) { - while( curr < len[t][i] ) + while( curr < len[ t ][ i ] ) { bsW( 2, 2 ); curr++; @@ -1610,7 +1612,7 @@ while ( h <= 256 ); * 10 */ } - while( curr > len[t][i] ) + while( curr > len[ t ][ i ] ) { bsW( 2, 3 ); curr--; @@ -1637,8 +1639,8 @@ while ( h <= 256 ); ge = nMTF - 1; for( i = gs; i <= ge; i++ ) { - bsW( len[selector[selCtr]][szptr[i]], - code[selector[selCtr]][szptr[i]] ); + bsW( len[ selector[ selCtr ] ][ szptr[ i ] ], + code[ selector[ selCtr ] ][ szptr[ i ] ] ); } gs = ge + 1; @@ -1662,13 +1664,13 @@ while ( h <= 256 ); return; hp = 0; - while( incs[hp] < bigN ) + while( incs[ hp ] < bigN ) hp++; hp--; for( ; hp >= 0; hp-- ) { - h = incs[hp]; + h = incs[ hp ]; i = lo + h; while( true ) @@ -1678,16 +1680,16 @@ while ( h <= 256 ); */ if( i > hi ) break; - v = zptr[i]; + v = zptr[ i ]; j = i; - while( fullGtU( zptr[j - h] + d, v + d ) ) + while( fullGtU( zptr[ j - h ] + d, v + d ) ) { - zptr[j] = zptr[j - h]; + zptr[ j ] = zptr[ j - h ]; j = j - h; if( j <= ( lo + h - 1 ) ) break; } - zptr[j] = v; + zptr[ j ] = v; i++; /* @@ -1695,16 +1697,16 @@ while ( h <= 256 ); */ if( i > hi ) break; - v = zptr[i]; + v = zptr[ i ]; j = i; - while( fullGtU( zptr[j - h] + d, v + d ) ) + while( fullGtU( zptr[ j - h ] + d, v + d ) ) { - zptr[j] = zptr[j - h]; + zptr[ j ] = zptr[ j - h ]; j = j - h; if( j <= ( lo + h - 1 ) ) break; } - zptr[j] = v; + zptr[ j ] = v; i++; /* @@ -1712,16 +1714,16 @@ while ( h <= 256 ); */ if( i > hi ) break; - v = zptr[i]; + v = zptr[ i ]; j = i; - while( fullGtU( zptr[j - h] + d, v + d ) ) + while( fullGtU( zptr[ j - h ] + d, v + d ) ) { - zptr[j] = zptr[j - h]; + zptr[ j ] = zptr[ j - h ]; j = j - h; if( j <= ( lo + h - 1 ) ) break; } - zptr[j] = v; + zptr[ j ] = v; i++; if( workDone > workLimit && firstAttempt ) @@ -1735,9 +1737,9 @@ while ( h <= 256 ); int temp = 0; while( n > 0 ) { - temp = zptr[p1]; - zptr[p1] = zptr[p2]; - zptr[p2] = temp; + temp = zptr[ p1 ]; + zptr[ p1 ] = zptr[ p2 ]; + zptr[ p2 ] = temp; p1++; p2++; n--; @@ -1749,44 +1751,44 @@ while ( h <= 256 ); { if( last < allowableBlockSize ) { - inUse[currentChar] = true; + inUse[ currentChar ] = true; for( int i = 0; i < runLength; i++ ) { - mCrc.updateCRC( ( char )currentChar ); + mCrc.updateCRC( (char)currentChar ); } - switch ( runLength ) + switch( runLength ) { - case 1: - last++; - block[last + 1] = ( char )currentChar; - break; - case 2: - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - break; - case 3: - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - break; - default: - inUse[runLength - 4] = true; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )( runLength - 4 ); - break; + case 1: + last++; + block[ last + 1 ] = (char)currentChar; + break; + case 2: + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + break; + case 3: + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + break; + default: + inUse[ runLength - 4 ] = true; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)( runLength - 4 ); + break; } } else diff --git a/proposal/myrmidon/src/main/org/apache/tools/bzip2/CRC.java b/proposal/myrmidon/src/main/org/apache/tools/bzip2/CRC.java index f12b482a6..e213673b9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/bzip2/CRC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/bzip2/CRC.java @@ -80,7 +80,7 @@ class CRC 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 - }; + }; int globalCrc; @@ -114,7 +114,7 @@ class CRC int temp = ( globalCrc >> 24 ) ^ inCh; if( temp < 0 ) temp = 256 + temp; - globalCrc = ( globalCrc << 8 ) ^ CRC.crc32Table[temp]; + globalCrc = ( globalCrc << 8 ) ^ CRC.crc32Table[ temp ]; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/mail/MailMessage.java b/proposal/myrmidon/src/main/org/apache/tools/mail/MailMessage.java index 924296429..6d9aac441 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/mail/MailMessage.java +++ b/proposal/myrmidon/src/main/org/apache/tools/mail/MailMessage.java @@ -6,16 +6,17 @@ * the LICENSE file. */ package org.apache.tools.mail; + import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.net.InetAddress; import java.net.Socket; -import java.util.Iterator; -import java.util.Hashtable; import java.util.ArrayList; import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; /** * A class to help send SMTP email. This class is an improvement on the @@ -348,7 +349,7 @@ public class MailMessage // Check that the response is one of the valid codes for( int i = 0; i < ok.length; i++ ) { - if( response.startsWith( "" + ok[i] ) ) + if( response.startsWith( "" + ok[ i ] ) ) { return true; } @@ -364,7 +365,7 @@ public class MailMessage socket = new Socket( host, port ); out = new MailPrintStream( new BufferedOutputStream( - socket.getOutputStream() ) ); + socket.getOutputStream() ) ); in = new SmtpResponseReader( socket.getInputStream() ); getReady(); } @@ -387,8 +388,8 @@ public class MailMessage Enumeration e = headers.keys(); while( e.hasMoreElements() ) { - String name = ( String )e.nextElement(); - String value = ( String )headers.get( name ); + String name = (String)e.nextElement(); + String value = (String)headers.get( name ); out.println( name + ": " + value ); } out.println(); @@ -471,6 +472,7 @@ public class MailMessage // This PrintStream subclass makes sure that . becomes .. // per RFC 821. It also ensures that new lines are always \r\n. // + class MailPrintStream extends PrintStream { @@ -506,7 +508,7 @@ class MailPrintStream extends PrintStream { for( int i = 0; i < len; i++ ) { - write( buf[off + i] ); + write( buf[ off + i ] ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/mail/SmtpResponseReader.java b/proposal/myrmidon/src/main/org/apache/tools/mail/SmtpResponseReader.java index 73f935bfc..cfbcc0091 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/mail/SmtpResponseReader.java +++ b/proposal/myrmidon/src/main/org/apache/tools/mail/SmtpResponseReader.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.mail; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; diff --git a/proposal/myrmidon/src/main/org/apache/tools/tar/TarBuffer.java b/proposal/myrmidon/src/main/org/apache/tools/tar/TarBuffer.java index a580a3377..68b8d7fa5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/tar/TarBuffer.java +++ b/proposal/myrmidon/src/main/org/apache/tools/tar/TarBuffer.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.tar; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -137,7 +138,7 @@ public class TarBuffer { for( int i = 0, sz = this.getRecordSize(); i < sz; ++i ) { - if( record[i] != 0 ) + if( record[ i ] != 0 ) { return false; } @@ -165,7 +166,7 @@ public class TarBuffer this.flushBlock(); if( this.outStream != System.out - && this.outStream != System.err ) + && this.outStream != System.err ) { this.outStream.close(); @@ -195,7 +196,7 @@ public class TarBuffer if( this.debug ) { System.err.println( "ReadRecord: recIdx = " + this.currRecIdx - + " blkIdx = " + this.currBlkIdx ); + + " blkIdx = " + this.currBlkIdx ); } if( this.inStream == null ) @@ -211,11 +212,11 @@ public class TarBuffer } } - byte[] result = new byte[this.recordSize]; + byte[] result = new byte[ this.recordSize ]; System.arraycopy( this.blockBuffer, - ( this.currRecIdx * this.recordSize ), result, 0, - this.recordSize ); + ( this.currRecIdx * this.recordSize ), result, 0, + this.recordSize ); this.currRecIdx++; @@ -233,7 +234,7 @@ public class TarBuffer if( this.debug ) { System.err.println( "SkipRecord: recIdx = " + this.currRecIdx - + " blkIdx = " + this.currBlkIdx ); + + " blkIdx = " + this.currBlkIdx ); } if( this.inStream == null ) @@ -264,7 +265,7 @@ public class TarBuffer if( this.debug ) { System.err.println( "WriteRecord: recIdx = " + this.currRecIdx - + " blkIdx = " + this.currBlkIdx ); + + " blkIdx = " + this.currBlkIdx ); } if( this.outStream == null ) @@ -275,9 +276,9 @@ public class TarBuffer if( record.length != this.recordSize ) { throw new IOException( "record to write has length '" - + record.length - + "' which is not the record size of '" - + this.recordSize + "'" ); + + record.length + + "' which is not the record size of '" + + this.recordSize + "'" ); } if( this.currRecIdx >= this.recsPerBlock ) @@ -286,8 +287,8 @@ public class TarBuffer } System.arraycopy( record, 0, this.blockBuffer, - ( this.currRecIdx * this.recordSize ), - this.recordSize ); + ( this.currRecIdx * this.recordSize ), + this.recordSize ); this.currRecIdx++; } @@ -306,7 +307,7 @@ public class TarBuffer if( this.debug ) { System.err.println( "WriteRecord: recIdx = " + this.currRecIdx - + " blkIdx = " + this.currBlkIdx ); + + " blkIdx = " + this.currBlkIdx ); } if( this.outStream == null ) @@ -317,9 +318,9 @@ public class TarBuffer if( ( offset + this.recordSize ) > buf.length ) { throw new IOException( "record has length '" + buf.length - + "' with offset '" + offset - + "' which is less than the record size of '" - + this.recordSize + "'" ); + + "' with offset '" + offset + + "' which is less than the record size of '" + + this.recordSize + "'" ); } if( this.currRecIdx >= this.recsPerBlock ) @@ -328,8 +329,8 @@ public class TarBuffer } System.arraycopy( buf, offset, this.blockBuffer, - ( this.currRecIdx * this.recordSize ), - this.recordSize ); + ( this.currRecIdx * this.recordSize ), + this.recordSize ); this.currRecIdx++; } @@ -370,7 +371,7 @@ public class TarBuffer this.blockSize = blockSize; this.recordSize = recordSize; this.recsPerBlock = ( this.blockSize / this.recordSize ); - this.blockBuffer = new byte[this.blockSize]; + this.blockBuffer = new byte[ this.blockSize ]; if( this.inStream != null ) { @@ -409,7 +410,7 @@ public class TarBuffer while( bytesNeeded > 0 ) { long numBytes = this.inStream.read( this.blockBuffer, offset, - bytesNeeded ); + bytesNeeded ); // // NOTE @@ -437,8 +438,8 @@ public class TarBuffer if( this.debug ) { System.err.println( "ReadBlock: INCOMPLETE READ " - + numBytes + " of " + this.blockSize - + " bytes read." ); + + numBytes + " of " + this.blockSize + + " bytes read." ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/tar/TarConstants.java b/proposal/myrmidon/src/main/org/apache/tools/tar/TarConstants.java index 6203d31d1..993447743 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/tar/TarConstants.java +++ b/proposal/myrmidon/src/main/org/apache/tools/tar/TarConstants.java @@ -82,42 +82,42 @@ public interface TarConstants /** * Normal file type. */ - byte LF_NORMAL = ( byte )'0'; + byte LF_NORMAL = (byte)'0'; /** * Link file type. */ - byte LF_LINK = ( byte )'1'; + byte LF_LINK = (byte)'1'; /** * Symbolic link file type. */ - byte LF_SYMLINK = ( byte )'2'; + byte LF_SYMLINK = (byte)'2'; /** * Character device file type. */ - byte LF_CHR = ( byte )'3'; + byte LF_CHR = (byte)'3'; /** * Block device file type. */ - byte LF_BLK = ( byte )'4'; + byte LF_BLK = (byte)'4'; /** * Directory file type. */ - byte LF_DIR = ( byte )'5'; + byte LF_DIR = (byte)'5'; /** * FIFO (pipe) file type. */ - byte LF_FIFO = ( byte )'6'; + byte LF_FIFO = (byte)'6'; /** * Contiguous file type. */ - byte LF_CONTIG = ( byte )'7'; + byte LF_CONTIG = (byte)'7'; /** * The magic tag representing a POSIX tar archive. @@ -137,5 +137,5 @@ public interface TarConstants /** * Identifies the *next* file on the tape as having a long name. */ - byte LF_GNUTYPE_LONGNAME = ( byte )'L'; + byte LF_GNUTYPE_LONGNAME = (byte)'L'; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/tar/TarEntry.java b/proposal/myrmidon/src/main/org/apache/tools/tar/TarEntry.java index 7914dd132..e666a7064 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/tar/TarEntry.java +++ b/proposal/myrmidon/src/main/org/apache/tools/tar/TarEntry.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.tar; + import java.io.File; import java.util.Date; @@ -190,8 +191,8 @@ public class TarEntry implements TarConstants char ch2 = name.charAt( 1 ); if( ch2 == ':' - && ( ( ch1 >= 'a' && ch1 <= 'z' ) - || ( ch1 >= 'A' && ch1 <= 'Z' ) ) ) + && ( ( ch1 >= 'a' && ch1 <= 'z' ) + || ( ch1 >= 'A' && ch1 <= 'Z' ) ) ) { name = name.substring( 2 ); } @@ -406,15 +407,15 @@ public class TarEntry implements TarConstants { if( this.file == null || !this.file.isDirectory() ) { - return new TarEntry[0]; + return new TarEntry[ 0 ]; } String[] list = this.file.list(); - TarEntry[] result = new TarEntry[list.length]; + TarEntry[] result = new TarEntry[ list.length ]; for( int i = 0; i < list.length; ++i ) { - result[i] = new TarEntry( new File( this.file, list[i] ) ); + result[ i ] = new TarEntry( new File( this.file, list[ i ] ) ); } return result; @@ -490,7 +491,6 @@ public class TarEntry implements TarConstants return this.size; } - /** * Get this entry's user id. * @@ -549,7 +549,6 @@ public class TarEntry implements TarConstants return false; } - /** * Indicate if this entry is a GNU long name block * @@ -585,19 +584,19 @@ public class TarEntry implements TarConstants this.name = TarUtils.parseName( header, offset, NAMELEN ); offset += NAMELEN; - this.mode = ( int )TarUtils.parseOctal( header, offset, MODELEN ); + this.mode = (int)TarUtils.parseOctal( header, offset, MODELEN ); offset += MODELEN; - this.userId = ( int )TarUtils.parseOctal( header, offset, UIDLEN ); + this.userId = (int)TarUtils.parseOctal( header, offset, UIDLEN ); offset += UIDLEN; - this.groupId = ( int )TarUtils.parseOctal( header, offset, GIDLEN ); + this.groupId = (int)TarUtils.parseOctal( header, offset, GIDLEN ); offset += GIDLEN; this.size = TarUtils.parseOctal( header, offset, SIZELEN ); offset += SIZELEN; this.modTime = TarUtils.parseOctal( header, offset, MODTIMELEN ); offset += MODTIMELEN; - this.checkSum = ( int )TarUtils.parseOctal( header, offset, CHKSUMLEN ); + this.checkSum = (int)TarUtils.parseOctal( header, offset, CHKSUMLEN ); offset += CHKSUMLEN; - this.linkFlag = header[offset++]; + this.linkFlag = header[ offset++ ]; this.linkName = TarUtils.parseName( header, offset, NAMELEN ); offset += NAMELEN; this.magic = TarUtils.parseName( header, offset, MAGICLEN ); @@ -606,9 +605,9 @@ public class TarEntry implements TarConstants offset += UNAMELEN; this.groupName = TarUtils.parseName( header, offset, GNAMELEN ); offset += GNAMELEN; - this.devMajor = ( int )TarUtils.parseOctal( header, offset, DEVLEN ); + this.devMajor = (int)TarUtils.parseOctal( header, offset, DEVLEN ); offset += DEVLEN; - this.devMinor = ( int )TarUtils.parseOctal( header, offset, DEVLEN ); + this.devMinor = (int)TarUtils.parseOctal( header, offset, DEVLEN ); } /** @@ -631,10 +630,10 @@ public class TarEntry implements TarConstants for( int c = 0; c < CHKSUMLEN; ++c ) { - outbuf[offset++] = ( byte )' '; + outbuf[ offset++ ] = (byte)' '; } - outbuf[offset++] = this.linkFlag; + outbuf[ offset++ ] = this.linkFlag; offset = TarUtils.getNameBytes( this.linkName, outbuf, offset, NAMELEN ); offset = TarUtils.getNameBytes( this.magic, outbuf, offset, MAGICLEN ); offset = TarUtils.getNameBytes( this.userName, outbuf, offset, UNAMELEN ); @@ -644,7 +643,7 @@ public class TarEntry implements TarConstants while( offset < outbuf.length ) { - outbuf[offset++] = 0; + outbuf[ offset++ ] = 0; } long checkSum = TarUtils.computeCheckSum( outbuf ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/tar/TarInputStream.java b/proposal/myrmidon/src/main/org/apache/tools/tar/TarInputStream.java index 5e340e6ae..feff6a775 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/tar/TarInputStream.java +++ b/proposal/myrmidon/src/main/org/apache/tools/tar/TarInputStream.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.tar; + import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; @@ -48,7 +49,7 @@ public class TarInputStream extends FilterInputStream this.buffer = new TarBuffer( is, blockSize, recordSize ); this.readBuf = null; - this.oneBuf = new byte[1]; + this.oneBuf = new byte[ 1 ]; this.debug = false; this.hasHitEOF = false; } @@ -90,10 +91,10 @@ public class TarInputStream extends FilterInputStream if( this.debug ) { System.err.println( "TarInputStream: SKIP currENTRY '" - + this.currEntry.getName() + "' SZ " - + this.entrySize + " OFF " - + this.entryOffset + " skipping " - + numToSkip + " bytes" ); + + this.currEntry.getName() + "' SZ " + + this.entrySize + " OFF " + + this.entryOffset + " skipping " + + numToSkip + " bytes" ); } if( numToSkip > 0 ) @@ -131,56 +132,56 @@ public class TarInputStream extends FilterInputStream { this.currEntry = new TarEntry( headerBuf ); - if( !( headerBuf[257] == 'u' && headerBuf[258] == 's' - && headerBuf[259] == 't' && headerBuf[260] == 'a' - && headerBuf[261] == 'r' ) ) + if( !( headerBuf[ 257 ] == 'u' && headerBuf[ 258 ] == 's' + && headerBuf[ 259 ] == 't' && headerBuf[ 260 ] == 'a' + && headerBuf[ 261 ] == 'r' ) ) { this.entrySize = 0; this.entryOffset = 0; this.currEntry = null; throw new IOException( "bad header in block " - + this.buffer.getCurrentBlockNum() - + " record " - + this.buffer.getCurrentRecordNum() - + ", " + - "header magic is not 'ustar', but '" - + headerBuf[257] - + headerBuf[258] - + headerBuf[259] - + headerBuf[260] - + headerBuf[261] - + "', or (dec) " - + ( ( int )headerBuf[257] ) - + ", " - + ( ( int )headerBuf[258] ) - + ", " - + ( ( int )headerBuf[259] ) - + ", " - + ( ( int )headerBuf[260] ) - + ", " - + ( ( int )headerBuf[261] ) ); + + this.buffer.getCurrentBlockNum() + + " record " + + this.buffer.getCurrentRecordNum() + + ", " + + "header magic is not 'ustar', but '" + + headerBuf[ 257 ] + + headerBuf[ 258 ] + + headerBuf[ 259 ] + + headerBuf[ 260 ] + + headerBuf[ 261 ] + + "', or (dec) " + + ( (int)headerBuf[ 257 ] ) + + ", " + + ( (int)headerBuf[ 258 ] ) + + ", " + + ( (int)headerBuf[ 259 ] ) + + ", " + + ( (int)headerBuf[ 260 ] ) + + ", " + + ( (int)headerBuf[ 261 ] ) ); } if( this.debug ) { System.err.println( "TarInputStream: SET CURRENTRY '" - + this.currEntry.getName() - + "' size = " - + this.currEntry.getSize() ); + + this.currEntry.getName() + + "' size = " + + this.currEntry.getSize() ); } this.entryOffset = 0; // REVIEW How do we resolve this discrepancy?! - this.entrySize = ( int )this.currEntry.getSize(); + this.entrySize = (int)this.currEntry.getSize(); } if( this.currEntry != null && this.currEntry.isGNULongNameEntry() ) { // read in the name StringBuffer longName = new StringBuffer(); - byte[] buffer = new byte[256]; + byte[] buffer = new byte[ 256 ]; int length = 0; while( ( length = read( buffer ) ) >= 0 ) { @@ -240,7 +241,7 @@ public class TarInputStream extends FilterInputStream public void copyEntryContents( OutputStream out ) throws IOException { - byte[] buf = new byte[32 * 1024]; + byte[] buf = new byte[ 32 * 1024 ]; while( true ) { @@ -260,7 +261,9 @@ public class TarInputStream extends FilterInputStream * * @param markLimit The limit to mark. */ - public void mark( int markLimit ) { } + public void mark( int markLimit ) + { + } /** * Since we do not support marking just yet, we return false. @@ -290,7 +293,7 @@ public class TarInputStream extends FilterInputStream } else { - return ( int )this.oneBuf[0]; + return (int)this.oneBuf[ 0 ]; } } @@ -337,7 +340,7 @@ public class TarInputStream extends FilterInputStream if( this.readBuf != null ) { int sz = ( numToRead > this.readBuf.length ) ? this.readBuf.length - : numToRead; + : numToRead; System.arraycopy( this.readBuf, 0, buf, offset, sz ); @@ -348,7 +351,7 @@ public class TarInputStream extends FilterInputStream else { int newLen = this.readBuf.length - sz; - byte[] newBuf = new byte[newLen]; + byte[] newBuf = new byte[ newLen ]; System.arraycopy( this.readBuf, sz, newBuf, 0, newLen ); @@ -368,7 +371,7 @@ public class TarInputStream extends FilterInputStream { // Unexpected EOF! throw new IOException( "unexpected EOF with " + numToRead - + " bytes unread" ); + + " bytes unread" ); } int sz = numToRead; @@ -378,7 +381,7 @@ public class TarInputStream extends FilterInputStream { System.arraycopy( rec, 0, buf, offset, sz ); - this.readBuf = new byte[recLen - sz]; + this.readBuf = new byte[ recLen - sz ]; System.arraycopy( rec, sz, this.readBuf, 0, recLen - sz ); } @@ -402,7 +405,9 @@ public class TarInputStream extends FilterInputStream /** * Since we do not support marking just yet, we do nothing. */ - public void reset() { } + public void reset() + { + } /** * Skip bytes in the input buffer. This skips bytes in the current entry's @@ -420,13 +425,13 @@ public class TarInputStream extends FilterInputStream // This is horribly inefficient, but it ensures that we // properly skip over bytes via the TarBuffer... // - byte[] skipBuf = new byte[8 * 1024]; + byte[] skipBuf = new byte[ 8 * 1024 ]; - for( int num = numToSkip; num > 0; ) + for( int num = numToSkip; num > 0; ) { int numRead = this.read( skipBuf, 0, - ( num > skipBuf.length ? skipBuf.length - : num ) ); + ( num > skipBuf.length ? skipBuf.length + : num ) ); if( numRead == -1 ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/tar/TarOutputStream.java b/proposal/myrmidon/src/main/org/apache/tools/tar/TarOutputStream.java index 92914c329..f60cd3a09 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/tar/TarOutputStream.java +++ b/proposal/myrmidon/src/main/org/apache/tools/tar/TarOutputStream.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.tar; + import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -50,9 +51,9 @@ public class TarOutputStream extends FilterOutputStream this.buffer = new TarBuffer( os, blockSize, recordSize ); this.debug = false; this.assemLen = 0; - this.assemBuf = new byte[recordSize]; - this.recordBuf = new byte[recordSize]; - this.oneBuf = new byte[1]; + this.assemBuf = new byte[ recordSize ]; + this.recordBuf = new byte[ recordSize ]; + this.oneBuf = new byte[ 1 ]; } /** @@ -65,7 +66,6 @@ public class TarOutputStream extends FilterOutputStream this.buffer.setDebug( debug ); } - /** * Sets the debugging flag. * @@ -120,7 +120,7 @@ public class TarOutputStream extends FilterOutputStream { for( int i = this.assemLen; i < this.assemBuf.length; ++i ) { - this.assemBuf[i] = 0; + this.assemBuf[ i ] = 0; } this.buffer.writeRecord( this.assemBuf ); @@ -132,8 +132,8 @@ public class TarOutputStream extends FilterOutputStream if( this.currBytes < this.currSize ) { throw new IOException( "entry closed at '" + this.currBytes - + "' before the '" + this.currSize - + "' bytes specified in the header were written" ); + + "' before the '" + this.currSize + + "' bytes specified in the header were written" ); } } @@ -171,7 +171,7 @@ public class TarOutputStream extends FilterOutputStream // create a TarEntry for the LongLink, the contents // of which are the entry's name TarEntry longLinkEntry = new TarEntry( TarConstants.GNU_LONGLINK, - TarConstants.LF_GNUTYPE_LONGNAME ); + TarConstants.LF_GNUTYPE_LONGNAME ); longLinkEntry.setSize( entry.getName().length() + 1 ); putNextEntry( longLinkEntry ); @@ -182,8 +182,8 @@ public class TarOutputStream extends FilterOutputStream else if( longFileMode != LONGFILE_TRUNCATE ) { throw new RuntimeException( "file name '" + entry.getName() - + "' is too long ( > " - + TarConstants.NAMELEN + " bytes)" ); + + "' is too long ( > " + + TarConstants.NAMELEN + " bytes)" ); } } @@ -198,7 +198,7 @@ public class TarOutputStream extends FilterOutputStream } else { - this.currSize = ( int )entry.getSize(); + this.currSize = (int)entry.getSize(); } } @@ -212,7 +212,7 @@ public class TarOutputStream extends FilterOutputStream public void write( int b ) throws IOException { - this.oneBuf[0] = ( byte )b; + this.oneBuf[ 0 ] = (byte)b; this.write( this.oneBuf, 0, 1 ); } @@ -249,8 +249,8 @@ public class TarOutputStream extends FilterOutputStream if( ( this.currBytes + numToWrite ) > this.currSize ) { throw new IOException( "request to write '" + numToWrite - + "' bytes exceeds size in header of '" - + this.currSize + "' bytes" ); + + "' bytes exceeds size in header of '" + + this.currSize + "' bytes" ); // // We have to deal with assembly!!! // The programmer can be writing little 32 byte chunks for all @@ -267,9 +267,9 @@ public class TarOutputStream extends FilterOutputStream int aLen = this.recordBuf.length - this.assemLen; System.arraycopy( this.assemBuf, 0, this.recordBuf, 0, - this.assemLen ); + this.assemLen ); System.arraycopy( wBuf, wOffset, this.recordBuf, - this.assemLen, aLen ); + this.assemLen, aLen ); this.buffer.writeRecord( this.recordBuf ); this.currBytes += this.recordBuf.length; @@ -280,7 +280,7 @@ public class TarOutputStream extends FilterOutputStream else { System.arraycopy( wBuf, wOffset, this.assemBuf, this.assemLen, - numToWrite ); + numToWrite ); wOffset += numToWrite; this.assemLen += numToWrite; @@ -298,7 +298,7 @@ public class TarOutputStream extends FilterOutputStream if( numToWrite < this.recordBuf.length ) { System.arraycopy( wBuf, wOffset, this.assemBuf, this.assemLen, - numToWrite ); + numToWrite ); this.assemLen += numToWrite; @@ -326,7 +326,7 @@ public class TarOutputStream extends FilterOutputStream { for( int i = 0; i < this.recordBuf.length; ++i ) { - this.recordBuf[i] = 0; + this.recordBuf[ i ] = 0; } this.buffer.writeRecord( this.recordBuf ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/tar/TarUtils.java b/proposal/myrmidon/src/main/org/apache/tools/tar/TarUtils.java index 40bf84d59..1d06e6945 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/tar/TarUtils.java +++ b/proposal/myrmidon/src/main/org/apache/tools/tar/TarUtils.java @@ -30,8 +30,8 @@ public class TarUtils { getOctalBytes( value, buf, offset, length ); - buf[offset + length - 1] = ( byte )' '; - buf[offset + length - 2] = 0; + buf[ offset + length - 1 ] = (byte)' '; + buf[ offset + length - 2 ] = 0; return offset + length; } @@ -47,7 +47,7 @@ public class TarUtils */ public static int getLongOctalBytes( long value, byte[] buf, int offset, int length ) { - byte[] temp = new byte[length + 1]; + byte[] temp = new byte[ length + 1 ]; getOctalBytes( value, temp, 0, length + 1 ); System.arraycopy( temp, 0, buf, offset, length ); @@ -70,12 +70,12 @@ public class TarUtils for( i = 0; i < length && i < name.length(); ++i ) { - buf[offset + i] = ( byte )name.charAt( i ); + buf[ offset + i ] = (byte)name.charAt( i ); } for( ; i < length; ++i ) { - buf[offset + i] = 0; + buf[ offset + i ] = 0; } return offset + length; @@ -92,31 +92,31 @@ public class TarUtils */ public static int getOctalBytes( long value, byte[] buf, int offset, int length ) { - byte[] result = new byte[length]; + byte[] result = new byte[ length ]; int idx = length - 1; - buf[offset + idx] = 0; + buf[ offset + idx ] = 0; --idx; - buf[offset + idx] = ( byte )' '; + buf[ offset + idx ] = (byte)' '; --idx; if( value == 0 ) { - buf[offset + idx] = ( byte )'0'; + buf[ offset + idx ] = (byte)'0'; --idx; } else { for( long val = value; idx >= 0 && val > 0; --idx ) { - buf[offset + idx] = ( byte )( ( byte )'0' + ( byte )( val & 7 ) ); + buf[ offset + idx ] = (byte)( (byte)'0' + (byte)( val & 7 ) ); val = val >> 3; } } for( ; idx >= 0; --idx ) { - buf[offset + idx] = ( byte )' '; + buf[ offset + idx ] = (byte)' '; } return offset + length; @@ -134,7 +134,7 @@ public class TarUtils for( int i = 0; i < buf.length; ++i ) { - sum += 255 & buf[i]; + sum += 255 & buf[ i ]; } return sum; @@ -155,12 +155,12 @@ public class TarUtils for( int i = offset; i < end; ++i ) { - if( header[i] == 0 ) + if( header[ i ] == 0 ) { break; } - result.append( ( char )header[i] ); + result.append( (char)header[ i ] ); } return result; @@ -183,26 +183,26 @@ public class TarUtils for( int i = offset; i < end; ++i ) { - if( header[i] == 0 ) + if( header[ i ] == 0 ) { break; } - if( header[i] == ( byte )' ' || header[i] == '0' ) + if( header[ i ] == (byte)' ' || header[ i ] == '0' ) { if( stillPadding ) { continue; } - if( header[i] == ( byte )' ' ) + if( header[ i ] == (byte)' ' ) { break; } } stillPadding = false; - result = ( result << 3 ) + ( header[i] - '0' ); + result = ( result << 3 ) + ( header[ i ] - '0' ); } return result; diff --git a/proposal/myrmidon/src/main/org/apache/tools/zip/AsiExtraField.java b/proposal/myrmidon/src/main/org/apache/tools/zip/AsiExtraField.java index e2e3c9122..d2b11d138 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/zip/AsiExtraField.java +++ b/proposal/myrmidon/src/main/org/apache/tools/zip/AsiExtraField.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.zip; + import java.util.zip.CRC32; import java.util.zip.ZipException; @@ -79,7 +80,9 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable */ private CRC32 crc = new CRC32(); - public AsiExtraField() { } + public AsiExtraField() + { + } /** * Indicate whether this entry is a directory. @@ -205,17 +208,17 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable public byte[] getLocalFileDataData() { // CRC will be added later - byte[] data = new byte[getLocalFileDataLength().getValue() - 4]; + byte[] data = new byte[ getLocalFileDataLength().getValue() - 4 ]; System.arraycopy( ( new ZipShort( getMode() ) ).getBytes(), 0, data, 0, 2 ); byte[] linkArray = getLinkedFile().getBytes(); System.arraycopy( ( new ZipLong( linkArray.length ) ).getBytes(), - 0, data, 2, 4 ); + 0, data, 2, 4 ); System.arraycopy( ( new ZipShort( getUserId() ) ).getBytes(), - 0, data, 6, 2 ); + 0, data, 6, 2 ); System.arraycopy( ( new ZipShort( getGroupId() ) ).getBytes(), - 0, data, 8, 2 ); + 0, data, 8, 2 ); System.arraycopy( linkArray, 0, data, 10, linkArray.length ); @@ -223,7 +226,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable crc.update( data ); long checksum = crc.getValue(); - byte[] result = new byte[data.length + 4]; + byte[] result = new byte[ data.length + 4 ]; System.arraycopy( ( new ZipLong( checksum ) ).getBytes(), 0, result, 0, 4 ); System.arraycopy( data, 0, result, 4, data.length ); return result; @@ -239,11 +242,11 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable public ZipShort getLocalFileDataLength() { return new ZipShort( 4// CRC - + 2// Mode - + 4// SizDev - + 2// UID - + 2// GID - + getLinkedFile().getBytes().length ); + + 2// Mode + + 4// SizDev + + 2// UID + + 2// GID + + getLinkedFile().getBytes().length ); } /** @@ -304,7 +307,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable { long givenChecksum = ( new ZipLong( data, offset ) ).getValue(); - byte[] tmp = new byte[length - 4]; + byte[] tmp = new byte[ length - 4 ]; System.arraycopy( data, offset + 4, tmp, 0, length - 4 ); crc.reset(); crc.update( tmp ); @@ -312,13 +315,13 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable if( givenChecksum != realChecksum ) { throw new ZipException( "bad CRC checksum " - + Long.toHexString( givenChecksum ) - + " instead of " - + Long.toHexString( realChecksum ) ); + + Long.toHexString( givenChecksum ) + + " instead of " + + Long.toHexString( realChecksum ) ); } int newMode = ( new ZipShort( tmp, 0 ) ).getValue(); - byte[] linkArray = new byte[( int )( new ZipLong( tmp, 2 ) ).getValue()]; + byte[] linkArray = new byte[ (int)( new ZipLong( tmp, 2 ) ).getValue() ]; uid = ( new ZipShort( tmp, 6 ) ).getValue(); gid = ( new ZipShort( tmp, 8 ) ).getValue(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/zip/UnrecognizedExtraField.java b/proposal/myrmidon/src/main/org/apache/tools/zip/UnrecognizedExtraField.java index 092e1c60b..bcc404863 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/zip/UnrecognizedExtraField.java +++ b/proposal/myrmidon/src/main/org/apache/tools/zip/UnrecognizedExtraField.java @@ -92,7 +92,7 @@ public class UnrecognizedExtraField implements ZipExtraField public void parseFromLocalFileData( byte[] data, int offset, int length ) { - byte[] tmp = new byte[length]; + byte[] tmp = new byte[ length ]; System.arraycopy( data, offset, tmp, 0, length ); setLocalFileDataData( tmp ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipEntry.java b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipEntry.java index 721c3ca77..99a4620eb 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipEntry.java +++ b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipEntry.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.zip; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; @@ -120,7 +121,7 @@ public class ZipEntry extends java.util.zip.ZipEntry public ZipEntry( ZipEntry entry ) throws ZipException { - this( ( java.util.zip.ZipEntry )entry ); + this( (java.util.zip.ZipEntry)entry ); setInternalAttributes( entry.getInternalAttributes() ); setExternalAttributes( entry.getExternalAttributes() ); setExtraFields( entry.getExtraFields() ); @@ -142,7 +143,7 @@ public class ZipEntry extends java.util.zip.ZipEntry { setCompressedSizeMethod = java.util.zip.ZipEntry.class.getMethod( "setCompressedSize", - new Class[]{Long.TYPE} ); + new Class[]{Long.TYPE} ); } catch( NoSuchMethodException nse ) { @@ -181,14 +182,14 @@ public class ZipEntry extends java.util.zip.ZipEntry { Throwable nested = ite.getTargetException(); throw new RuntimeException( "Exception setting the compressed size " - + "of " + ze + ": " - + nested.getMessage() ); + + "of " + ze + ": " + + nested.getMessage() ); } catch( Throwable other ) { throw new RuntimeException( "Exception setting the compressed size " - + "of " + ze + ": " - + other.getMessage() ); + + "of " + ze + ": " + + other.getMessage() ); } } @@ -255,7 +256,7 @@ public class ZipEntry extends java.util.zip.ZipEntry extraFields.clear(); for( int i = 0; i < fields.length; i++ ) { - extraFields.add( fields[i] ); + extraFields.add( fields[ i ] ); } setExtra(); } @@ -341,7 +342,7 @@ public class ZipEntry extends java.util.zip.ZipEntry public byte[] getLocalFileDataExtra() { byte[] extra = getExtra(); - return extra != null ? extra : new byte[0]; + return extra != null ? extra : new byte[ 0 ]; } /** @@ -357,7 +358,7 @@ public class ZipEntry extends java.util.zip.ZipEntry boolean done = false; for( int i = 0; !done && i < extraFields.size(); i++ ) { - if( ( ( ZipExtraField )extraFields.get( i ) ).getHeaderId().equals( type ) ) + if( ( (ZipExtraField)extraFields.get( i ) ).getHeaderId().equals( type ) ) { extraFields.set( i, ze ); done = true; @@ -381,7 +382,7 @@ public class ZipEntry extends java.util.zip.ZipEntry ZipEntry e = null; try { - e = new ZipEntry( ( java.util.zip.ZipEntry )super.clone() ); + e = new ZipEntry( (java.util.zip.ZipEntry)super.clone() ); } catch( Exception ex ) { @@ -405,7 +406,7 @@ public class ZipEntry extends java.util.zip.ZipEntry boolean done = false; for( int i = 0; !done && i < extraFields.size(); i++ ) { - if( ( ( ZipExtraField )extraFields.get( i ) ).getHeaderId().equals( type ) ) + if( ( (ZipExtraField)extraFields.get( i ) ).getHeaderId().equals( type ) ) { extraFields.remove( i ); done = true; diff --git a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipExtraField.java b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipExtraField.java index 534530706..38ad35840 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipExtraField.java +++ b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipExtraField.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.zip; + import java.util.zip.ZipException; /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipLong.java b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipLong.java index 4b3573770..f5ddc968a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipLong.java +++ b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipLong.java @@ -50,10 +50,10 @@ public class ZipLong implements Cloneable */ public ZipLong( byte[] bytes, int offset ) { - value = ( bytes[offset + 3] << 24 ) & 0xFF000000l; - value += ( bytes[offset + 2] << 16 ) & 0xFF0000; - value += ( bytes[offset + 1] << 8 ) & 0xFF00; - value += ( bytes[offset] & 0xFF ); + value = ( bytes[ offset + 3 ] << 24 ) & 0xFF000000l; + value += ( bytes[ offset + 2 ] << 16 ) & 0xFF0000; + value += ( bytes[ offset + 1 ] << 8 ) & 0xFF00; + value += ( bytes[ offset ] & 0xFF ); } /** @@ -64,11 +64,11 @@ public class ZipLong implements Cloneable */ public byte[] getBytes() { - byte[] result = new byte[4]; - result[0] = ( byte )( ( value & 0xFF ) ); - result[1] = ( byte )( ( value & 0xFF00 ) >> 8 ); - result[2] = ( byte )( ( value & 0xFF0000 ) >> 16 ); - result[3] = ( byte )( ( value & 0xFF000000l ) >> 24 ); + byte[] result = new byte[ 4 ]; + result[ 0 ] = (byte)( ( value & 0xFF ) ); + result[ 1 ] = (byte)( ( value & 0xFF00 ) >> 8 ); + result[ 2 ] = (byte)( ( value & 0xFF0000 ) >> 16 ); + result[ 3 ] = (byte)( ( value & 0xFF000000l ) >> 24 ); return result; } @@ -96,7 +96,7 @@ public class ZipLong implements Cloneable { return false; } - return value == ( ( ZipLong )o ).getValue(); + return value == ( (ZipLong)o ).getValue(); } /** @@ -107,7 +107,7 @@ public class ZipLong implements Cloneable */ public int hashCode() { - return ( int )value; + return (int)value; } }// ZipLong diff --git a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipOutputStream.java b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipOutputStream.java index 725171a25..b483437b4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipOutputStream.java +++ b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipOutputStream.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.zip; + import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; +import java.util.ArrayList; import java.util.Date; import java.util.Hashtable; -import java.util.ArrayList; import java.util.zip.CRC32; import java.util.zip.Deflater; import java.util.zip.DeflaterOutputStream; @@ -216,17 +217,17 @@ public class ZipOutputStream extends DeflaterOutputStream return DOS_TIME_MIN; } long value = ( ( year - 1980 ) << 25 ) - | ( month << 21 ) - | ( time.getDate() << 16 ) - | ( time.getHours() << 11 ) - | ( time.getMinutes() << 5 ) - | ( time.getSeconds() >> 1 ); - - byte[] result = new byte[4]; - result[0] = ( byte )( ( value & 0xFF ) ); - result[1] = ( byte )( ( value & 0xFF00 ) >> 8 ); - result[2] = ( byte )( ( value & 0xFF0000 ) >> 16 ); - result[3] = ( byte )( ( value & 0xFF000000l ) >> 24 ); + | ( month << 21 ) + | ( time.getDate() << 16 ) + | ( time.getHours() << 11 ) + | ( time.getMinutes() << 5 ) + | ( time.getSeconds() >> 1 ); + + byte[] result = new byte[ 4 ]; + result[ 0 ] = (byte)( ( value & 0xFF ) ); + result[ 1 ] = (byte)( ( value & 0xFF00 ) >> 8 ); + result[ 2 ] = (byte)( ( value & 0xFF0000 ) >> 16 ); + result[ 3 ] = (byte)( ( value & 0xFF000000l ) >> 24 ); return new ZipLong( result ); } @@ -332,19 +333,19 @@ public class ZipOutputStream extends DeflaterOutputStream if( entry.getCrc() != realCrc ) { throw new ZipException( "bad CRC checksum for entry " - + entry.getName() + ": " - + Long.toHexString( entry.getCrc() ) - + " instead of " - + Long.toHexString( realCrc ) ); + + entry.getName() + ": " + + Long.toHexString( entry.getCrc() ) + + " instead of " + + Long.toHexString( realCrc ) ); } if( entry.getSize() != written - dataStart ) { throw new ZipException( "bad size for entry " - + entry.getName() + ": " - + entry.getSize() - + " instead of " - + ( written - dataStart ) ); + + entry.getName() + ": " + + entry.getSize() + + " instead of " + + ( written - dataStart ) ); } } @@ -372,7 +373,7 @@ public class ZipOutputStream extends DeflaterOutputStream cdOffset = new ZipLong( written ); for( int i = 0; i < entries.size(); i++ ) { - writeCentralFileHeader( ( ZipEntry )entries.get( i ) ); + writeCentralFileHeader( (ZipEntry)entries.get( i ) ); } cdLength = new ZipLong( written - cdOffset.getValue() ); writeCentralDirectoryEnd(); @@ -593,7 +594,7 @@ public class ZipOutputStream extends DeflaterOutputStream written += 4; // relative offset of LFH - out.write( ( ( ZipLong )offsets.get( ze ) ).getBytes() ); + out.write( ( (ZipLong)offsets.get( ze ) ).getBytes() ); written += 4; // file name diff --git a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipShort.java b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipShort.java index b06f040e1..6462bd2a9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/zip/ZipShort.java +++ b/proposal/myrmidon/src/main/org/apache/tools/zip/ZipShort.java @@ -50,8 +50,8 @@ public class ZipShort implements Cloneable */ public ZipShort( byte[] bytes, int offset ) { - value = ( bytes[offset + 1] << 8 ) & 0xFF00; - value += ( bytes[offset] & 0xFF ); + value = ( bytes[ offset + 1 ] << 8 ) & 0xFF00; + value += ( bytes[ offset ] & 0xFF ); } /** @@ -62,9 +62,9 @@ public class ZipShort implements Cloneable */ public byte[] getBytes() { - byte[] result = new byte[2]; - result[0] = ( byte )( value & 0xFF ); - result[1] = ( byte )( ( value & 0xFF00 ) >> 8 ); + byte[] result = new byte[ 2 ]; + result[ 0 ] = (byte)( value & 0xFF ); + result[ 1 ] = (byte)( ( value & 0xFF00 ) >> 8 ); return result; } @@ -92,7 +92,7 @@ public class ZipShort implements Cloneable { return false; } - return value == ( ( ZipShort )o ).getValue(); + return value == ( (ZipShort)o ).getValue(); } /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 1186cc5ed..fb5eef31a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -437,7 +437,6 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter Execute exe = new Execute( new LogStreamHandler( attributes, Project.MSG_INFO, Project.MSG_WARN ) ); - exe.setAntRun( project ); exe.setWorkingDirectory( project.getBaseDir() ); exe.setCommandline( commandArray ); exe.execute(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/And.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/And.java index 3f3631a9d..7c99b98fa 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/And.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/And.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.taskdefs.condition; -import java.util.Iterator; import java.util.Enumeration; import org.apache.myrmidon.api.TaskException; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/ConditionBase.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/ConditionBase.java index cc33bd4b3..a3e441ac8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/ConditionBase.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/ConditionBase.java @@ -7,10 +7,9 @@ */ package org.apache.tools.ant.taskdefs.condition; -import java.util.Iterator; -import java.util.NoSuchElementException; import java.util.ArrayList; import java.util.Enumeration; +import java.util.NoSuchElementException; import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.taskdefs.Available; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Copy.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Copy.java index fdc0ac145..d9b165904 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Copy.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Copy.java @@ -10,10 +10,9 @@ package org.apache.tools.ant.taskdefs.file; import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.Iterator; -import java.util.Hashtable; -import java.util.ArrayList; import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Delete.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Delete.java index f306977ca..9f3a58d97 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Delete.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Delete.java @@ -457,8 +457,8 @@ public class Delete if( dirCount > 0 ) { getLogger().info( "Deleted " + dirCount + " director" + - ( dirCount == 1 ? "y" : "ies" ) + - " from " + d.getAbsolutePath() ); + ( dirCount == 1 ? "y" : "ies" ) + + " from " + d.getAbsolutePath() ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Move.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Move.java index 324c52ca3..b429e3234 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Move.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/file/Move.java @@ -9,16 +9,15 @@ package org.apache.tools.ant.taskdefs.file; import java.io.File; import java.io.IOException; -import java.util.Iterator; -import java.util.Iterator; import java.util.Enumeration; +import java.util.Iterator; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; -import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FilterSet; import org.apache.tools.ant.types.FilterSetCollection; +import org.apache.tools.ant.util.FileUtils; /** * Moves a file or directory to a new file or directory. By default, the diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index cabff316a..51e8f9d9c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -8,8 +8,8 @@ package org.apache.tools.ant.taskdefs.rmic; import java.io.File; -import java.util.Random; import java.util.ArrayList; +import java.util.Random; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Rmic; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java index c6b275269..ec9e0af9e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java @@ -8,8 +8,8 @@ package org.apache.tools.ant.types; import java.io.File; -import java.util.StringTokenizer; import java.util.ArrayList; +import java.util.StringTokenizer; import org.apache.myrmidon.api.TaskException; /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileList.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileList.java index 87f6c7c88..e592ef15d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileList.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileList.java @@ -8,9 +8,9 @@ package org.apache.tools.ant.types; import java.io.File; +import java.util.ArrayList; import java.util.Stack; import java.util.StringTokenizer; -import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java index c267e6d0a..1504800c3 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java @@ -8,8 +8,8 @@ package org.apache.tools.ant.types; import java.io.File; -import java.util.Stack; import java.util.ArrayList; +import java.util.Stack; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.FileScanner; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java index f53090c8a..d32fb094f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java @@ -10,11 +10,11 @@ package org.apache.tools.ant.types;// java io classes import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.util.Iterator; -import java.util.Hashtable; -import java.util.Properties; import java.util.ArrayList; import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Properties; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSetCollection.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSetCollection.java index 99996b479..2d9d54622 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSetCollection.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSetCollection.java @@ -9,8 +9,8 @@ package org.apache.tools.ant.types;// java io classes // java util classes -import java.util.Iterator; import java.util.ArrayList; +import java.util.Iterator; import org.apache.myrmidon.api.TaskException; // ant classes diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java index 7fac34f05..3667aabe9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java @@ -8,10 +8,10 @@ package org.apache.tools.ant.types; import java.io.File; +import java.util.ArrayList; import java.util.Iterator; import java.util.Locale; import java.util.Stack; -import java.util.ArrayList; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/PatternSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/PatternSet.java index 947e81f39..f3f4b2ee8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/PatternSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/PatternSet.java @@ -11,10 +11,10 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.util.ArrayList; import java.util.Iterator; import java.util.Stack; import java.util.StringTokenizer; -import java.util.ArrayList; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; @@ -357,7 +357,7 @@ public class PatternSet extends DataType } final String[] result = new String[ tmpNames.size() ]; - return (String[]) tmpNames.toArray( result ); + return (String[])tmpNames.toArray( result ); } /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java index 65e296239..f502c13cf 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java @@ -9,11 +9,11 @@ package org.apache.tools.ant.util; import java.io.File; import java.util.ArrayList; +import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; -import org.apache.avalon.excalibur.io.FileUtil; /** * Utility class that collects the functionality of the various scanDir methods @@ -78,7 +78,7 @@ public class SourceFileScanner if( targets == null || targets.length == 0 ) { m_task.log( files[ i ] + " skipped - don\'t know how to handle it", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); continue; } @@ -87,7 +87,7 @@ public class SourceFileScanner if( src.lastModified() > now ) { m_task.log( "Warning: " + files[ i ] + " modified in the future.", - Project.MSG_WARN ); + Project.MSG_WARN ); } boolean added = false; @@ -99,14 +99,14 @@ public class SourceFileScanner if( !dest.exists() ) { m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); v.add( files[ i ] ); added = true; } else if( src.lastModified() > dest.lastModified() ) { m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); v.add( files[ i ] ); added = true; } @@ -123,8 +123,8 @@ public class SourceFileScanner if( !added ) { m_task.log( files[ i ] + " omitted as " + targetList.toString() - + ( targets.length == 1 ? " is" : " are " ) - + " up to date.", Project.MSG_VERBOSE ); + + ( targets.length == 1 ? " is" : " are " ) + + " up to date.", Project.MSG_VERBOSE ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/bzip2/BZip2Constants.java b/proposal/myrmidon/src/todo/org/apache/tools/bzip2/BZip2Constants.java index fa26ce9fc..63486ab7d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/bzip2/BZip2Constants.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/bzip2/BZip2Constants.java @@ -80,5 +80,5 @@ public interface BZip2Constants 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 936, 638 - }; + }; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CBZip2InputStream.java b/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CBZip2InputStream.java index d614359db..8f1c4eb65 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CBZip2InputStream.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CBZip2InputStream.java @@ -6,7 +6,9 @@ * the LICENSE file. */ package org.apache.tools.bzip2; -import java.io.*; + +import java.io.IOException; +import java.io.InputStream; /** * An input stream that decompresses from the BZip2 format (without the file @@ -26,24 +28,24 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private final static int NO_RAND_PART_C_STATE = 7; private CRC mCrc = new CRC(); - private boolean inUse[] = new boolean[256]; + private boolean inUse[] = new boolean[ 256 ]; - private char seqToUnseq[] = new char[256]; - private char unseqToSeq[] = new char[256]; + private char seqToUnseq[] = new char[ 256 ]; + private char unseqToSeq[] = new char[ 256 ]; - private char selector[] = new char[MAX_SELECTORS]; - private char selectorMtf[] = new char[MAX_SELECTORS]; + private char selector[] = new char[ MAX_SELECTORS ]; + private char selectorMtf[] = new char[ MAX_SELECTORS ]; /* * freq table collected to save a pass over the data * during decompression. */ - private int unzftab[] = new int[256]; + private int unzftab[] = new int[ 256 ]; - private int limit[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; - private int base[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; - private int perm[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; - private int minLens[] = new int[N_GROUPS]; + private int limit[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; + private int base[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; + private int perm[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; + private int minLens[] = new int[ N_GROUPS ]; private boolean streamEnd = false; @@ -146,28 +148,28 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants else { int retChar = currentChar; - switch ( currentState ) + switch( currentState ) { - case START_BLOCK_STATE: - break; - case RAND_PART_A_STATE: - break; - case RAND_PART_B_STATE: - setupRandPartB(); - break; - case RAND_PART_C_STATE: - setupRandPartC(); - break; - case NO_RAND_PART_A_STATE: - break; - case NO_RAND_PART_B_STATE: - setupNoRandPartB(); - break; - case NO_RAND_PART_C_STATE: - setupNoRandPartC(); - break; - default: - break; + case START_BLOCK_STATE: + break; + case RAND_PART_A_STATE: + break; + case RAND_PART_B_STATE: + setupRandPartB(); + break; + case RAND_PART_C_STATE: + setupRandPartC(); + break; + case NO_RAND_PART_A_STATE: + break; + case NO_RAND_PART_B_STATE: + setupNoRandPartB(); + break; + case NO_RAND_PART_C_STATE: + setupNoRandPartC(); + break; + default: + break; } return retChar; } @@ -176,7 +178,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private void setDecompressStructureSizes( int newSize100k ) { if( !( 0 <= newSize100k && newSize100k <= 9 && 0 <= blockSize100k - && blockSize100k <= 9 ) ) + && blockSize100k <= 9 ) ) { // throw new IOException("Invalid block size"); } @@ -187,30 +189,30 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants return; int n = baseBlockSize * newSize100k; - ll8 = new char[n]; - tt = new int[n]; + ll8 = new char[ n ]; + tt = new int[ n ]; } private void setupBlock() { - int cftab[] = new int[257]; + int cftab[] = new int[ 257 ]; char ch; - cftab[0] = 0; + cftab[ 0 ] = 0; for( i = 1; i <= 256; i++ ) - cftab[i] = unzftab[i - 1]; + cftab[ i ] = unzftab[ i - 1 ]; for( i = 1; i <= 256; i++ ) - cftab[i] += cftab[i - 1]; + cftab[ i ] += cftab[ i - 1 ]; for( i = 0; i <= last; i++ ) { - ch = ( char )ll8[i]; - tt[cftab[ch]] = i; - cftab[ch]++; + ch = (char)ll8[ i ]; + tt[ cftab[ ch ] ] = i; + cftab[ ch ]++; } cftab = null; - tPos = tt[origPtr]; + tPos = tt[ origPtr ]; count = 0; i2 = 0; @@ -235,8 +237,8 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants if( i2 <= last ) { chPrev = ch2; - ch2 = ll8[tPos]; - tPos = tt[tPos]; + ch2 = ll8[ tPos ]; + tPos = tt[ tPos ]; i2++; currentChar = ch2; @@ -264,8 +266,8 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants count++; if( count >= 4 ) { - z = ll8[tPos]; - tPos = tt[tPos]; + z = ll8[ tPos ]; + tPos = tt[ tPos ]; currentState = NO_RAND_PART_C_STATE; j2 = 0; setupNoRandPartC(); @@ -280,7 +282,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private void setupNoRandPartC() { - if( j2 < ( int )z ) + if( j2 < (int)z ) { currentChar = ch2; mCrc.updateCRC( ch2 ); @@ -300,17 +302,17 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants if( i2 <= last ) { chPrev = ch2; - ch2 = ll8[tPos]; - tPos = tt[tPos]; + ch2 = ll8[ tPos ]; + tPos = tt[ tPos ]; if( rNToGo == 0 ) { - rNToGo = rNums[rTPos]; + rNToGo = rNums[ rTPos ]; rTPos++; if( rTPos == 512 ) rTPos = 0; } rNToGo--; - ch2 ^= ( int )( ( rNToGo == 1 ) ? 1 : 0 ); + ch2 ^= (int)( ( rNToGo == 1 ) ? 1 : 0 ); i2++; currentChar = ch2; @@ -338,11 +340,11 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants count++; if( count >= 4 ) { - z = ll8[tPos]; - tPos = tt[tPos]; + z = ll8[ tPos ]; + tPos = tt[ tPos ]; if( rNToGo == 0 ) { - rNToGo = rNums[rTPos]; + rNToGo = rNums[ rTPos ]; rTPos++; if( rTPos == 512 ) rTPos = 0; @@ -363,7 +365,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private void setupRandPartC() { - if( j2 < ( int )z ) + if( j2 < (int)z ) { currentChar = ch2; mCrc.updateCRC( ch2 ); @@ -380,7 +382,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private void getAndMoveToFrontDecode() { - char yy[] = new char[256]; + char yy[] = new char[ 256 ]; int i; int j; int nextSym; @@ -404,10 +406,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants * cache misses. */ for( i = 0; i <= 255; i++ ) - unzftab[i] = 0; + unzftab[ i ] = 0; for( i = 0; i <= 255; i++ ) - yy[i] = ( char )i; + yy[ i ] = (char)i; last = -1; { @@ -421,10 +423,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants groupPos = G_SIZE; } groupPos--; - zt = selector[groupNo]; - zn = minLens[zt]; + zt = selector[ groupNo ]; + zn = minLens[ zt ]; zvec = bsR( zn ); - while( zvec > limit[zt][zn] ) + while( zvec > limit[ zt ][ zn ] ) { zn++; { @@ -435,7 +437,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants char thech = 0; try { - thech = ( char )bsStream.read(); + thech = (char)bsStream.read(); } catch( IOException e ) { @@ -455,7 +457,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants } zvec = ( zvec << 1 ) | zj; } - nextSym = perm[zt][zvec - base[zt][zn]]; + nextSym = perm[ zt ][ zvec - base[ zt ][ zn ] ]; } while( true ) @@ -487,10 +489,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants groupPos = G_SIZE; } groupPos--; - zt = selector[groupNo]; - zn = minLens[zt]; + zt = selector[ groupNo ]; + zn = minLens[ zt ]; zvec = bsR( zn ); - while( zvec > limit[zt][zn] ) + while( zvec > limit[ zt ][ zn ] ) { zn++; { @@ -501,7 +503,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants char thech = 0; try { - thech = ( char )bsStream.read(); + thech = (char)bsStream.read(); } catch( IOException e ) { @@ -522,18 +524,18 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants zvec = ( zvec << 1 ) | zj; } ; - nextSym = perm[zt][zvec - base[zt][zn]]; + nextSym = perm[ zt ][ zvec - base[ zt ][ zn ] ]; } - }while ( nextSym == RUNA || nextSym == RUNB ); + } while( nextSym == RUNA || nextSym == RUNB ); s++; - ch = seqToUnseq[yy[0]]; - unzftab[ch] += s; + ch = seqToUnseq[ yy[ 0 ] ]; + unzftab[ ch ] += s; while( s > 0 ) { last++; - ll8[last] = ch; + ll8[ last ] = ch; s--; } ; @@ -549,9 +551,9 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants if( last >= limitLast ) blockOverrun(); - tmp = yy[nextSym - 1]; - unzftab[seqToUnseq[tmp]]++; - ll8[last] = seqToUnseq[tmp]; + tmp = yy[ nextSym - 1 ]; + unzftab[ seqToUnseq[ tmp ] ]++; + ll8[ last ] = seqToUnseq[ tmp ]; /* * This loop is hammered during decompression, @@ -561,15 +563,15 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants j = nextSym - 1; for( ; j > 3; j -= 4 ) { - yy[j] = yy[j - 1]; - yy[j - 1] = yy[j - 2]; - yy[j - 2] = yy[j - 3]; - yy[j - 3] = yy[j - 4]; + yy[ j ] = yy[ j - 1 ]; + yy[ j - 1 ] = yy[ j - 2 ]; + yy[ j - 2 ] = yy[ j - 3 ]; + yy[ j - 3 ] = yy[ j - 4 ]; } for( ; j > 0; j-- ) - yy[j] = yy[j - 1]; + yy[ j ] = yy[ j - 1 ]; - yy[0] = tmp; + yy[ 0 ] = tmp; { int zt; int zn; @@ -581,10 +583,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants groupPos = G_SIZE; } groupPos--; - zt = selector[groupNo]; - zn = minLens[zt]; + zt = selector[ groupNo ]; + zn = minLens[ zt ]; zvec = bsR( zn ); - while( zvec > limit[zt][zn] ) + while( zvec > limit[ zt ][ zn ] ) { zn++; { @@ -595,7 +597,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants char thech = 0; try { - thech = ( char )bsStream.read(); + thech = (char)bsStream.read(); } catch( IOException e ) { @@ -612,7 +614,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants zvec = ( zvec << 1 ) | zj; } ; - nextSym = perm[zt][zvec - base[zt][zn]]; + nextSym = perm[ zt ][ zvec - base[ zt ][ zn ] ]; } continue; } @@ -626,17 +628,17 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants private int bsGetInt32() { - return ( int )bsGetint(); + return (int)bsGetint(); } private int bsGetIntVS( int numBits ) { - return ( int )bsR( numBits ); + return (int)bsR( numBits ); } private char bsGetUChar() { - return ( char )bsR( 8 ); + return (char)bsR( 8 ); } private int bsGetint() @@ -659,7 +661,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants char thech = 0; try { - thech = ( char )bsStream.read(); + thech = (char)bsStream.read(); } catch( IOException e ) { @@ -709,7 +711,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants crcError(); computedCombinedCRC = ( computedCombinedCRC << 1 ) - | ( computedCombinedCRC >>> 31 ); + | ( computedCombinedCRC >>> 31 ); computedCombinedCRC ^= computedBlockCRC; } @@ -725,33 +727,33 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants pp = 0; for( i = minLen; i <= maxLen; i++ ) for( j = 0; j < alphaSize; j++ ) - if( length[j] == i ) + if( length[ j ] == i ) { - perm[pp] = j; + perm[ pp ] = j; pp++; } ; for( i = 0; i < MAX_CODE_LEN; i++ ) - base[i] = 0; + base[ i ] = 0; for( i = 0; i < alphaSize; i++ ) - base[length[i] + 1]++; + base[ length[ i ] + 1 ]++; for( i = 1; i < MAX_CODE_LEN; i++ ) - base[i] += base[i - 1]; + base[ i ] += base[ i - 1 ]; for( i = 0; i < MAX_CODE_LEN; i++ ) - limit[i] = 0; + limit[ i ] = 0; vec = 0; for( i = minLen; i <= maxLen; i++ ) { - vec += ( base[i + 1] - base[i] ); - limit[i] = vec - 1; + vec += ( base[ i + 1 ] - base[ i ] ); + limit[ i ] = vec - 1; vec <<= 1; } for( i = minLen + 1; i <= maxLen; i++ ) - base[i] = ( ( limit[i - 1] + 1 ) << 1 ) - base[i]; + base[ i ] = ( ( limit[ i - 1 ] + 1 ) << 1 ) - base[ i ]; } private void initBlock() @@ -769,14 +771,14 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants magic5 = bsGetUChar(); magic6 = bsGetUChar(); if( magic1 == 0x17 && magic2 == 0x72 && magic3 == 0x45 - && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90 ) + && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90 ) { complete(); return; } if( magic1 != 0x31 || magic2 != 0x41 || magic3 != 0x59 - || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59 ) + || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59 ) { badBlockHeader(); streamEnd = true; @@ -819,17 +821,17 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants int i; nInUse = 0; for( i = 0; i < 256; i++ ) - if( inUse[i] ) + if( inUse[ i ] ) { - seqToUnseq[nInUse] = ( char )i; - unseqToSeq[i] = ( char )nInUse; + seqToUnseq[ nInUse ] = (char)i; + unseqToSeq[ i ] = (char)nInUse; nInUse++; } } private void recvDecodingTables() { - char len[][] = new char[N_GROUPS][MAX_ALPHA_SIZE]; + char len[][] = new char[ N_GROUPS ][ MAX_ALPHA_SIZE ]; int i; int j; int t; @@ -838,25 +840,25 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants int alphaSize; int minLen; int maxLen; - boolean inUse16[] = new boolean[16]; + boolean inUse16[] = new boolean[ 16 ]; /* * Receive the mapping table */ for( i = 0; i < 16; i++ ) if( bsR( 1 ) == 1 ) - inUse16[i] = true; + inUse16[ i ] = true; else - inUse16[i] = false; + inUse16[ i ] = false; for( i = 0; i < 256; i++ ) - inUse[i] = false; + inUse[ i ] = false; for( i = 0; i < 16; i++ ) - if( inUse16[i] ) + if( inUse16[ i ] ) for( j = 0; j < 16; j++ ) if( bsR( 1 ) == 1 ) - inUse[i * 16 + j] = true; + inUse[ i * 16 + j ] = true; makeMaps(); alphaSize = nInUse + 2; @@ -871,29 +873,29 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants j = 0; while( bsR( 1 ) == 1 ) j++; - selectorMtf[i] = ( char )j; + selectorMtf[ i ] = (char)j; } { /* * Undo the MTF values for the selectors. */ - char pos[] = new char[N_GROUPS]; + char pos[] = new char[ N_GROUPS ]; char tmp; char v; for( v = 0; v < nGroups; v++ ) - pos[v] = v; + pos[ v ] = v; for( i = 0; i < nSelectors; i++ ) { - v = selectorMtf[i]; - tmp = pos[v]; + v = selectorMtf[ i ]; + tmp = pos[ v ]; while( v > 0 ) { - pos[v] = pos[v - 1]; + pos[ v ] = pos[ v - 1 ]; v--; } - pos[0] = tmp; - selector[i] = tmp; + pos[ 0 ] = tmp; + selector[ i ] = tmp; } } @@ -912,7 +914,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants else curr--; } - len[t][i] = ( char )curr; + len[ t ][ i ] = (char)curr; } } @@ -925,14 +927,14 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants maxLen = 0; for( i = 0; i < alphaSize; i++ ) { - if( len[t][i] > maxLen ) - maxLen = len[t][i]; - if( len[t][i] < minLen ) - minLen = len[t][i]; + if( len[ t ][ i ] > maxLen ) + maxLen = len[ t ][ i ]; + if( len[ t ][ i ] < minLen ) + minLen = len[ t ][ i ]; } - hbCreateDecodeTables( limit[t], base[t], perm[t], len[t], minLen, - maxLen, alphaSize ); - minLens[t] = minLen; + hbCreateDecodeTables( limit[ t ], base[ t ], perm[ t ], len[ t ], minLen, + maxLen, alphaSize ); + minLens[ t ] = minLen; } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CBZip2OutputStream.java b/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CBZip2OutputStream.java index 7ee53781c..83e7e4473 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CBZip2OutputStream.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CBZip2OutputStream.java @@ -6,7 +6,9 @@ * the LICENSE file. */ package org.apache.tools.bzip2; -import java.io.*; + +import java.io.IOException; +import java.io.OutputStream; /** * An output stream that compresses into the BZip2 format (without the file @@ -35,15 +37,15 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants protected final static int QSORT_STACK_SIZE = 1000; CRC mCrc = new CRC(); - private boolean inUse[] = new boolean[256]; + private boolean inUse[] = new boolean[ 256 ]; - private char seqToUnseq[] = new char[256]; - private char unseqToSeq[] = new char[256]; + private char seqToUnseq[] = new char[ 256 ]; + private char unseqToSeq[] = new char[ 256 ]; - private char selector[] = new char[MAX_SELECTORS]; - private char selectorMtf[] = new char[MAX_SELECTORS]; + private char selector[] = new char[ MAX_SELECTORS ]; + private char selectorMtf[] = new char[ MAX_SELECTORS ]; - private int mtfFreq[] = new int[MAX_ALPHA_SIZE]; + private int mtfFreq[] = new int[ MAX_ALPHA_SIZE ]; private int currentChar = -1; private int runLength = 0; @@ -57,8 +59,8 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants * usually small, typically <= 20. */ private int incs[] = {1, 4, 13, 40, 121, 364, 1093, 3280, - 9841, 29524, 88573, 265720, - 797161, 2391484}; + 9841, 29524, 88573, 265720, + 797161, 2391484}; boolean blockRandomised; @@ -181,38 +183,38 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants int k; boolean tooLong; - int heap[] = new int[MAX_ALPHA_SIZE + 2]; - int weight[] = new int[MAX_ALPHA_SIZE * 2]; - int parent[] = new int[MAX_ALPHA_SIZE * 2]; + int heap[] = new int[ MAX_ALPHA_SIZE + 2 ]; + int weight[] = new int[ MAX_ALPHA_SIZE * 2 ]; + int parent[] = new int[ MAX_ALPHA_SIZE * 2 ]; for( i = 0; i < alphaSize; i++ ) - weight[i + 1] = ( freq[i] == 0 ? 1 : freq[i] ) << 8; + weight[ i + 1 ] = ( freq[ i ] == 0 ? 1 : freq[ i ] ) << 8; while( true ) { nNodes = alphaSize; nHeap = 0; - heap[0] = 0; - weight[0] = 0; - parent[0] = -2; + heap[ 0 ] = 0; + weight[ 0 ] = 0; + parent[ 0 ] = -2; for( i = 1; i <= alphaSize; i++ ) { - parent[i] = -1; + parent[ i ] = -1; nHeap++; - heap[nHeap] = i; + heap[ nHeap ] = i; { int zz; int tmp; zz = nHeap; - tmp = heap[zz]; - while( weight[tmp] < weight[heap[zz >> 1]] ) + tmp = heap[ zz ]; + while( weight[ tmp ] < weight[ heap[ zz >> 1 ] ] ) { - heap[zz] = heap[zz >> 1]; + heap[ zz ] = heap[ zz >> 1 ]; zz >>= 1; } - heap[zz] = tmp; + heap[ zz ] = tmp; } } if( !( nHeap < ( MAX_ALPHA_SIZE + 2 ) ) ) @@ -220,78 +222,78 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants while( nHeap > 1 ) { - n1 = heap[1]; - heap[1] = heap[nHeap]; + n1 = heap[ 1 ]; + heap[ 1 ] = heap[ nHeap ]; nHeap--; { int zz = 0; int yy = 0; int tmp = 0; zz = 1; - tmp = heap[zz]; + tmp = heap[ zz ]; while( true ) { yy = zz << 1; if( yy > nHeap ) break; if( yy < nHeap && - weight[heap[yy + 1]] < weight[heap[yy]] ) + weight[ heap[ yy + 1 ] ] < weight[ heap[ yy ] ] ) yy++; - if( weight[tmp] < weight[heap[yy]] ) + if( weight[ tmp ] < weight[ heap[ yy ] ] ) break; - heap[zz] = heap[yy]; + heap[ zz ] = heap[ yy ]; zz = yy; } - heap[zz] = tmp; + heap[ zz ] = tmp; } - n2 = heap[1]; - heap[1] = heap[nHeap]; + n2 = heap[ 1 ]; + heap[ 1 ] = heap[ nHeap ]; nHeap--; { int zz = 0; int yy = 0; int tmp = 0; zz = 1; - tmp = heap[zz]; + tmp = heap[ zz ]; while( true ) { yy = zz << 1; if( yy > nHeap ) break; if( yy < nHeap && - weight[heap[yy + 1]] < weight[heap[yy]] ) + weight[ heap[ yy + 1 ] ] < weight[ heap[ yy ] ] ) yy++; - if( weight[tmp] < weight[heap[yy]] ) + if( weight[ tmp ] < weight[ heap[ yy ] ] ) break; - heap[zz] = heap[yy]; + heap[ zz ] = heap[ yy ]; zz = yy; } - heap[zz] = tmp; + heap[ zz ] = tmp; } nNodes++; - parent[n1] = parent[n2] = nNodes; + parent[ n1 ] = parent[ n2 ] = nNodes; - weight[nNodes] = ( ( weight[n1] & 0xffffff00 ) - + ( weight[n2] & 0xffffff00 ) ) - | ( 1 + ( ( ( weight[n1] & 0x000000ff ) > - ( weight[n2] & 0x000000ff ) ) ? - ( weight[n1] & 0x000000ff ) : - ( weight[n2] & 0x000000ff ) ) ); + weight[ nNodes ] = ( ( weight[ n1 ] & 0xffffff00 ) + + ( weight[ n2 ] & 0xffffff00 ) ) + | ( 1 + ( ( ( weight[ n1 ] & 0x000000ff ) > + ( weight[ n2 ] & 0x000000ff ) ) ? + ( weight[ n1 ] & 0x000000ff ) : + ( weight[ n2 ] & 0x000000ff ) ) ); - parent[nNodes] = -1; + parent[ nNodes ] = -1; nHeap++; - heap[nHeap] = nNodes; + heap[ nHeap ] = nNodes; { int zz = 0; int tmp = 0; zz = nHeap; - tmp = heap[zz]; - while( weight[tmp] < weight[heap[zz >> 1]] ) + tmp = heap[ zz ]; + while( weight[ tmp ] < weight[ heap[ zz >> 1 ] ] ) { - heap[zz] = heap[zz >> 1]; + heap[ zz ] = heap[ zz >> 1 ]; zz >>= 1; } - heap[zz] = tmp; + heap[ zz ] = tmp; } } if( !( nNodes < ( MAX_ALPHA_SIZE * 2 ) ) ) @@ -302,12 +304,12 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants { j = 0; k = i; - while( parent[k] >= 0 ) + while( parent[ k ] >= 0 ) { - k = parent[k]; + k = parent[ k ]; j++; } - len[i - 1] = ( char )j; + len[ i - 1 ] = (char)j; if( j > maxLen ) tooLong = true; } @@ -317,9 +319,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants for( i = 1; i < alphaSize; i++ ) { - j = weight[i] >> 8; + j = weight[ i ] >> 8; j = 1 + ( j / 2 ); - weight[i] = j << 8; + weight[ i ] = j << 8; } } } @@ -398,13 +400,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants private void allocateCompressStructures() { int n = baseBlockSize * blockSize100k; - block = new char[( n + 1 + NUM_OVERSHOOT_BYTES )]; - quadrant = new int[( n + NUM_OVERSHOOT_BYTES )]; - zptr = new int[n]; - ftab = new int[65537]; + block = new char[ ( n + 1 + NUM_OVERSHOOT_BYTES ) ]; + quadrant = new int[ ( n + NUM_OVERSHOOT_BYTES ) ]; + zptr = new int[ n ]; + ftab = new int[ 65537 ]; if( block == null || quadrant == null || zptr == null - || ftab == null ) + || ftab == null ) { //int totalDraw = (n + 1 + NUM_OVERSHOOT_BYTES) + (n + NUM_OVERSHOOT_BYTES) + n + 65537; //compressOutOfMemory ( totalDraw, n ); @@ -422,7 +424,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants */ // szptr = zptr; - szptr = new short[2 * n]; + szptr = new short[ 2 * n ]; } private void bsFinishedWithStream() @@ -519,7 +521,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants origPtr = -1; for( i = 0; i <= last; i++ ) - if( zptr[i] == 0 ) + if( zptr[ i ] == 0 ) { origPtr = i; break; @@ -616,43 +618,43 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants int s1; int s2; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); i1++; @@ -662,45 +664,45 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants do { - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); - s1 = quadrant[i1]; - s2 = quadrant[i2]; + s1 = quadrant[ i1 ]; + s2 = quadrant[ i2 ]; if( s1 != s2 ) return ( s1 > s2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); - s1 = quadrant[i1]; - s2 = quadrant[i2]; + s1 = quadrant[ i1 ]; + s2 = quadrant[ i2 ]; if( s1 != s2 ) return ( s1 > s2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); - s1 = quadrant[i1]; - s2 = quadrant[i2]; + s1 = quadrant[ i1 ]; + s2 = quadrant[ i2 ]; if( s1 != s2 ) return ( s1 > s2 ); i1++; i2++; - c1 = block[i1 + 1]; - c2 = block[i2 + 1]; + c1 = block[ i1 + 1 ]; + c2 = block[ i2 + 1 ]; if( c1 != c2 ) return ( c1 > c2 ); - s1 = quadrant[i1]; - s2 = quadrant[i2]; + s1 = quadrant[ i1 ]; + s2 = quadrant[ i2 ]; if( s1 != s2 ) return ( s1 > s2 ); i1++; @@ -721,14 +723,14 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants k -= 4; workDone++; - }while ( k >= 0 ); + } while( k >= 0 ); return false; } private void generateMTFValues() { - char yy[] = new char[256]; + char yy[] = new char[ 256 ]; int i; int j; char tmp; @@ -741,30 +743,30 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants EOB = nInUse + 1; for( i = 0; i <= EOB; i++ ) - mtfFreq[i] = 0; + mtfFreq[ i ] = 0; wr = 0; zPend = 0; for( i = 0; i < nInUse; i++ ) - yy[i] = ( char )i; + yy[ i ] = (char)i; for( i = 0; i <= last; i++ ) { char ll_i; - ll_i = unseqToSeq[block[zptr[i]]]; + ll_i = unseqToSeq[ block[ zptr[ i ] ] ]; j = 0; - tmp = yy[j]; + tmp = yy[ j ]; while( ll_i != tmp ) { j++; tmp2 = tmp; - tmp = yy[j]; - yy[j] = tmp2; + tmp = yy[ j ]; + yy[ j ] = tmp2; } ; - yy[0] = tmp; + yy[ 0 ] = tmp; if( j == 0 ) { @@ -777,18 +779,18 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants zPend--; while( true ) { - switch ( zPend % 2 ) + switch( zPend % 2 ) { - case 0: - szptr[wr] = ( short )RUNA; - wr++; - mtfFreq[RUNA]++; - break; - case 1: - szptr[wr] = ( short )RUNB; - wr++; - mtfFreq[RUNB]++; - break; + case 0: + szptr[ wr ] = (short)RUNA; + wr++; + mtfFreq[ RUNA ]++; + break; + case 1: + szptr[ wr ] = (short)RUNB; + wr++; + mtfFreq[ RUNB ]++; + break; } ; if( zPend < 2 ) @@ -798,9 +800,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants ; zPend = 0; } - szptr[wr] = ( short )( j + 1 ); + szptr[ wr ] = (short)( j + 1 ); wr++; - mtfFreq[j + 1]++; + mtfFreq[ j + 1 ]++; } } @@ -809,18 +811,18 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants zPend--; while( true ) { - switch ( zPend % 2 ) + switch( zPend % 2 ) { - case 0: - szptr[wr] = ( short )RUNA; - wr++; - mtfFreq[RUNA]++; - break; - case 1: - szptr[wr] = ( short )RUNB; - wr++; - mtfFreq[RUNB]++; - break; + case 0: + szptr[ wr ] = (short)RUNA; + wr++; + mtfFreq[ RUNA ]++; + break; + case 1: + szptr[ wr ] = (short)RUNB; + wr++; + mtfFreq[ RUNB ]++; + break; } if( zPend < 2 ) break; @@ -828,9 +830,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants } } - szptr[wr] = ( short )EOB; + szptr[ wr ] = (short)EOB; wr++; - mtfFreq[EOB]++; + mtfFreq[ EOB ]++; nMTF = wr; } @@ -846,9 +848,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants for( n = minLen; n <= maxLen; n++ ) { for( i = 0; i < alphaSize; i++ ) - if( length[i] == n ) + if( length[ i ] == n ) { - code[i] = vec; + code[ i ] = vec; vec++; } ; @@ -864,7 +866,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants // ch = 0; for( int i = 0; i < 256; i++ ) - inUse[i] = false; + inUse[ i ] = false; /* * 20 is just a paranoia constant @@ -895,9 +897,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants int j; int ss; int sb; - int runningOrder[] = new int[256]; - int copy[] = new int[256]; - boolean bigDone[] = new boolean[256]; + int runningOrder[] = new int[ 256 ]; + int copy[] = new int[ 256 ]; + boolean bigDone[] = new boolean[ 256 ]; int c1; int c2; int numQSorted; @@ -909,11 +911,11 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants */ // if (verbosity >= 4) fprintf ( stderr, " sort initialise ...\n" ); for( i = 0; i < NUM_OVERSHOOT_BYTES; i++ ) - block[last + i + 2] = block[( i % ( last + 1 ) ) + 1]; + block[ last + i + 2 ] = block[ ( i % ( last + 1 ) ) + 1 ]; for( i = 0; i <= last + NUM_OVERSHOOT_BYTES; i++ ) - quadrant[i] = 0; + quadrant[ i ] = 0; - block[0] = ( char )( block[last + 1] ); + block[ 0 ] = (char)( block[ last + 1 ] ); if( last < 4000 ) { @@ -922,7 +924,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants * has quite a large constant overhead. */ for( i = 0; i <= last; i++ ) - zptr[i] = i; + zptr[ i ] = i; firstAttempt = false; workDone = workLimit = 0; simpleSort( 0, last, 0 ); @@ -931,35 +933,35 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants { numQSorted = 0; for( i = 0; i <= 255; i++ ) - bigDone[i] = false; + bigDone[ i ] = false; for( i = 0; i <= 65536; i++ ) - ftab[i] = 0; + ftab[ i ] = 0; - c1 = block[0]; + c1 = block[ 0 ]; for( i = 0; i <= last; i++ ) { - c2 = block[i + 1]; - ftab[( c1 << 8 ) + c2]++; + c2 = block[ i + 1 ]; + ftab[ ( c1 << 8 ) + c2 ]++; c1 = c2; } for( i = 1; i <= 65536; i++ ) - ftab[i] += ftab[i - 1]; + ftab[ i ] += ftab[ i - 1 ]; - c1 = block[1]; + c1 = block[ 1 ]; for( i = 0; i < last; i++ ) { - c2 = block[i + 2]; + c2 = block[ i + 2 ]; j = ( c1 << 8 ) + c2; c1 = c2; - ftab[j]--; - zptr[ftab[j]] = i; + ftab[ j ]--; + zptr[ ftab[ j ] ] = i; } - j = ( ( block[last + 1] ) << 8 ) + ( block[1] ); - ftab[j]--; - zptr[ftab[j]] = last; + j = ( ( block[ last + 1 ] ) << 8 ) + ( block[ 1 ] ); + ftab[ j ]--; + zptr[ ftab[ j ] ] = last; /* * Now ftab contains the first loc of every small bucket. @@ -967,32 +969,32 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants * big bucket. */ for( i = 0; i <= 255; i++ ) - runningOrder[i] = i; + runningOrder[ i ] = i; { int vv; int h = 1; do h = 3 * h + 1; -while ( h <= 256 ); + while( h <= 256 ); do { h = h / 3; for( i = h; i <= 255; i++ ) { - vv = runningOrder[i]; + vv = runningOrder[ i ]; j = i; - while( ( ftab[( ( runningOrder[j - h] ) + 1 ) << 8] - - ftab[( runningOrder[j - h] ) << 8] ) > - ( ftab[( ( vv ) + 1 ) << 8] - ftab[( vv ) << 8] ) ) + while( ( ftab[ ( ( runningOrder[ j - h ] ) + 1 ) << 8 ] + - ftab[ ( runningOrder[ j - h ] ) << 8 ] ) > + ( ftab[ ( ( vv ) + 1 ) << 8 ] - ftab[ ( vv ) << 8 ] ) ) { - runningOrder[j] = runningOrder[j - h]; + runningOrder[ j ] = runningOrder[ j - h ]; j = j - h; if( j <= ( h - 1 ) ) break; } - runningOrder[j] = vv; + runningOrder[ j ] = vv; } - }while ( h != 1 ); + } while( h != 1 ); } /* @@ -1004,7 +1006,7 @@ while ( h <= 256 ); /* * Process big buckets, starting with the least full. */ - ss = runningOrder[i]; + ss = runningOrder[ i ]; /* * Complete the big bucket [ss] by quicksorting @@ -1016,10 +1018,10 @@ while ( h <= 256 ); for( j = 0; j <= 255; j++ ) { sb = ( ss << 8 ) + j; - if( !( ( ftab[sb] & SETMASK ) == SETMASK ) ) + if( !( ( ftab[ sb ] & SETMASK ) == SETMASK ) ) { - int lo = ftab[sb] & CLEARMASK; - int hi = ( ftab[sb + 1] & CLEARMASK ) - 1; + int lo = ftab[ sb ] & CLEARMASK; + int hi = ( ftab[ sb + 1 ] & CLEARMASK ) - 1; if( hi > lo ) { qSort3( lo, hi, 2 ); @@ -1027,7 +1029,7 @@ while ( h <= 256 ); if( workDone > workLimit && firstAttempt ) return; } - ftab[sb] |= SETMASK; + ftab[ sb ] |= SETMASK; } } @@ -1039,12 +1041,12 @@ while ( h <= 256 ); * this updating for the last bucket processed, since * updating for the last bucket is pointless. */ - bigDone[ss] = true; + bigDone[ ss ] = true; if( i < 255 ) { - int bbStart = ftab[ss << 8] & CLEARMASK; - int bbSize = ( ftab[( ss + 1 ) << 8] & CLEARMASK ) - bbStart; + int bbStart = ftab[ ss << 8 ] & CLEARMASK; + int bbSize = ( ftab[ ( ss + 1 ) << 8 ] & CLEARMASK ) - bbStart; int shifts = 0; while( ( bbSize >> shifts ) > 65534 ) @@ -1052,11 +1054,11 @@ while ( h <= 256 ); for( j = 0; j < bbSize; j++ ) { - int a2update = zptr[bbStart + j]; + int a2update = zptr[ bbStart + j ]; int qVal = ( j >> shifts ); - quadrant[a2update] = qVal; + quadrant[ a2update ] = qVal; if( a2update < NUM_OVERSHOOT_BYTES ) - quadrant[a2update + last + 1] = qVal; + quadrant[ a2update + last + 1 ] = qVal; } if( !( ( ( bbSize - 1 ) >> shifts ) <= 65535 ) ) @@ -1068,21 +1070,21 @@ while ( h <= 256 ); * sorted order for small buckets [t, ss] for all t != ss. */ for( j = 0; j <= 255; j++ ) - copy[j] = ftab[( j << 8 ) + ss] & CLEARMASK; + copy[ j ] = ftab[ ( j << 8 ) + ss ] & CLEARMASK; - for( j = ftab[ss << 8] & CLEARMASK; - j < ( ftab[( ss + 1 ) << 8] & CLEARMASK ); j++ ) + for( j = ftab[ ss << 8 ] & CLEARMASK; + j < ( ftab[ ( ss + 1 ) << 8 ] & CLEARMASK ); j++ ) { - c1 = block[zptr[j]]; - if( !bigDone[c1] ) + c1 = block[ zptr[ j ] ]; + if( !bigDone[ c1 ] ) { - zptr[copy[c1]] = zptr[j] == 0 ? last : zptr[j] - 1; - copy[c1]++; + zptr[ copy[ c1 ] ] = zptr[ j ] == 0 ? last : zptr[ j ] - 1; + copy[ c1 ]++; } } for( j = 0; j <= 255; j++ ) - ftab[( j << 8 ) + ss] |= SETMASK; + ftab[ ( j << 8 ) + ss ] |= SETMASK; } } } @@ -1092,10 +1094,10 @@ while ( h <= 256 ); int i; nInUse = 0; for( i = 0; i < 256; i++ ) - if( inUse[i] ) + if( inUse[ i ] ) { - seqToUnseq[nInUse] = ( char )i; - unseqToSeq[i] = ( char )nInUse; + seqToUnseq[ nInUse ] = (char)i; + unseqToSeq[ i ] = (char)nInUse; nInUse++; } } @@ -1141,15 +1143,15 @@ while ( h <= 256 ); int lo; int hi; int d; - StackElem[] stack = new StackElem[QSORT_STACK_SIZE]; + StackElem[] stack = new StackElem[ QSORT_STACK_SIZE ]; for( int count = 0; count < QSORT_STACK_SIZE; count++ ) - stack[count] = new StackElem(); + stack[ count ] = new StackElem(); sp = 0; - stack[sp].ll = loSt; - stack[sp].hh = hiSt; - stack[sp].dd = dSt; + stack[ sp ].ll = loSt; + stack[ sp ].hh = hiSt; + stack[ sp ].dd = dSt; sp++; while( sp > 0 ) @@ -1158,9 +1160,9 @@ while ( h <= 256 ); panic(); sp--; - lo = stack[sp].ll; - hi = stack[sp].hh; - d = stack[sp].dd; + lo = stack[ sp ].ll; + hi = stack[ sp ].hh; + d = stack[ sp ].dd; if( hi - lo < SMALL_THRESH || d > DEPTH_THRESH ) { @@ -1170,9 +1172,9 @@ while ( h <= 256 ); continue; } - med = med3( block[zptr[lo] + d + 1], - block[zptr[hi] + d + 1], - block[zptr[( lo + hi ) >> 1] + d + 1] ); + med = med3( block[ zptr[ lo ] + d + 1 ], + block[ zptr[ hi ] + d + 1 ], + block[ zptr[ ( lo + hi ) >> 1 ] + d + 1 ] ); unLo = ltLo = lo; unHi = gtHi = hi; @@ -1183,13 +1185,13 @@ while ( h <= 256 ); { if( unLo > unHi ) break; - n = ( ( int )block[zptr[unLo] + d + 1] ) - med; + n = ( (int)block[ zptr[ unLo ] + d + 1 ] ) - med; if( n == 0 ) { int temp = 0; - temp = zptr[unLo]; - zptr[unLo] = zptr[ltLo]; - zptr[ltLo] = temp; + temp = zptr[ unLo ]; + zptr[ unLo ] = zptr[ ltLo ]; + zptr[ ltLo ] = temp; ltLo++; unLo++; continue; @@ -1203,13 +1205,13 @@ while ( h <= 256 ); { if( unLo > unHi ) break; - n = ( ( int )block[zptr[unHi] + d + 1] ) - med; + n = ( (int)block[ zptr[ unHi ] + d + 1 ] ) - med; if( n == 0 ) { int temp = 0; - temp = zptr[unHi]; - zptr[unHi] = zptr[gtHi]; - zptr[gtHi] = temp; + temp = zptr[ unHi ]; + zptr[ unHi ] = zptr[ gtHi ]; + zptr[ gtHi ] = temp; gtHi--; unHi--; continue; @@ -1222,18 +1224,18 @@ while ( h <= 256 ); if( unLo > unHi ) break; int temp = 0; - temp = zptr[unLo]; - zptr[unLo] = zptr[unHi]; - zptr[unHi] = temp; + temp = zptr[ unLo ]; + zptr[ unLo ] = zptr[ unHi ]; + zptr[ unHi ] = temp; unLo++; unHi--; } if( gtHi < ltLo ) { - stack[sp].ll = lo; - stack[sp].hh = hi; - stack[sp].dd = d + 1; + stack[ sp ].ll = lo; + stack[ sp ].hh = hi; + stack[ sp ].dd = d + 1; sp++; continue; } @@ -1246,19 +1248,19 @@ while ( h <= 256 ); n = lo + unLo - ltLo - 1; m = hi - ( gtHi - unHi ) + 1; - stack[sp].ll = lo; - stack[sp].hh = n; - stack[sp].dd = d; + stack[ sp ].ll = lo; + stack[ sp ].hh = n; + stack[ sp ].dd = d; sp++; - stack[sp].ll = n + 1; - stack[sp].hh = m - 1; - stack[sp].dd = d + 1; + stack[ sp ].ll = n + 1; + stack[ sp ].hh = m - 1; + stack[ sp ].dd = d + 1; sp++; - stack[sp].ll = m; - stack[sp].hh = hi; - stack[sp].dd = d; + stack[ sp ].ll = m; + stack[ sp ].hh = hi; + stack[ sp ].dd = d; sp++; } } @@ -1269,30 +1271,30 @@ while ( h <= 256 ); int rNToGo = 0; int rTPos = 0; for( i = 0; i < 256; i++ ) - inUse[i] = false; + inUse[ i ] = false; for( i = 0; i <= last; i++ ) { if( rNToGo == 0 ) { - rNToGo = ( char )rNums[rTPos]; + rNToGo = (char)rNums[ rTPos ]; rTPos++; if( rTPos == 512 ) rTPos = 0; } rNToGo--; - block[i + 1] ^= ( ( rNToGo == 1 ) ? 1 : 0 ); + block[ i + 1 ] ^= ( ( rNToGo == 1 ) ? 1 : 0 ); // handle 16 bit signed numbers - block[i + 1] &= 0xFF; + block[ i + 1 ] &= 0xFF; - inUse[block[i + 1]] = true; + inUse[ block[ i + 1 ] ] = true; } } private void sendMTFValues() throws IOException { - char len[][] = new char[N_GROUPS][MAX_ALPHA_SIZE]; + char len[][] = new char[ N_GROUPS ][ MAX_ALPHA_SIZE ]; int v; @@ -1324,7 +1326,7 @@ while ( h <= 256 ); alphaSize = nInUse + 2; for( t = 0; t < N_GROUPS; t++ ) for( v = 0; v < alphaSize; v++ ) - len[t][v] = ( char )GREATER_ICOST; + len[ t ][ v ] = (char)GREATER_ICOST; /* * Decide how many coding tables to use @@ -1362,21 +1364,21 @@ while ( h <= 256 ); while( aFreq < tFreq && ge < alphaSize - 1 ) { ge++; - aFreq += mtfFreq[ge]; + aFreq += mtfFreq[ ge ]; } if( ge > gs && nPart != nGroups && nPart != 1 - && ( ( nGroups - nPart ) % 2 == 1 ) ) + && ( ( nGroups - nPart ) % 2 == 1 ) ) { - aFreq -= mtfFreq[ge]; + aFreq -= mtfFreq[ ge ]; ge--; } for( v = 0; v < alphaSize; v++ ) if( v >= gs && v <= ge ) - len[nPart - 1][v] = ( char )LESSER_ICOST; + len[ nPart - 1 ][ v ] = (char)LESSER_ICOST; else - len[nPart - 1][v] = ( char )GREATER_ICOST; + len[ nPart - 1 ][ v ] = (char)GREATER_ICOST; nPart--; gs = ge + 1; @@ -1384,20 +1386,20 @@ while ( h <= 256 ); } } - int rfreq[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; - int fave[] = new int[N_GROUPS]; - short cost[] = new short[N_GROUPS]; + int rfreq[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; + int fave[] = new int[ N_GROUPS ]; + short cost[] = new short[ N_GROUPS ]; /* * Iterate up to N_ITERS times to improve the tables. */ for( iter = 0; iter < N_ITERS; iter++ ) { for( t = 0; t < nGroups; t++ ) - fave[t] = 0; + fave[ t ] = 0; for( t = 0; t < nGroups; t++ ) for( v = 0; v < alphaSize; v++ ) - rfreq[t][v] = 0; + rfreq[ t ][ v ] = 0; nSelectors = 0; totc = 0; @@ -1419,7 +1421,7 @@ while ( h <= 256 ); * by each of the coding tables. */ for( t = 0; t < nGroups; t++ ) - cost[t] = 0; + cost[ t ] = 0; if( nGroups == 6 ) { @@ -1432,28 +1434,28 @@ while ( h <= 256 ); cost0 = cost1 = cost2 = cost3 = cost4 = cost5 = 0; for( i = gs; i <= ge; i++ ) { - short icv = szptr[i]; - cost0 += len[0][icv]; - cost1 += len[1][icv]; - cost2 += len[2][icv]; - cost3 += len[3][icv]; - cost4 += len[4][icv]; - cost5 += len[5][icv]; + short icv = szptr[ i ]; + cost0 += len[ 0 ][ icv ]; + cost1 += len[ 1 ][ icv ]; + cost2 += len[ 2 ][ icv ]; + cost3 += len[ 3 ][ icv ]; + cost4 += len[ 4 ][ icv ]; + cost5 += len[ 5 ][ icv ]; } - cost[0] = cost0; - cost[1] = cost1; - cost[2] = cost2; - cost[3] = cost3; - cost[4] = cost4; - cost[5] = cost5; + cost[ 0 ] = cost0; + cost[ 1 ] = cost1; + cost[ 2 ] = cost2; + cost[ 3 ] = cost3; + cost[ 4 ] = cost4; + cost[ 5 ] = cost5; } else { for( i = gs; i <= ge; i++ ) { - short icv = szptr[i]; + short icv = szptr[ i ]; for( t = 0; t < nGroups; t++ ) - cost[t] += len[t][icv]; + cost[ t ] += len[ t ][ icv ]; } } @@ -1464,22 +1466,22 @@ while ( h <= 256 ); bc = 999999999; bt = -1; for( t = 0; t < nGroups; t++ ) - if( cost[t] < bc ) + if( cost[ t ] < bc ) { - bc = cost[t]; + bc = cost[ t ]; bt = t; } ; totc += bc; - fave[bt]++; - selector[nSelectors] = ( char )bt; + fave[ bt ]++; + selector[ nSelectors ] = (char)bt; nSelectors++; /* * Increment the symbol frequencies for the selected table. */ for( i = gs; i <= ge; i++ ) - rfreq[bt][szptr[i]]++; + rfreq[ bt ][ szptr[ i ] ]++; gs = ge + 1; } @@ -1488,7 +1490,7 @@ while ( h <= 256 ); * Recompute the tables based on the accumulated frequencies. */ for( t = 0; t < nGroups; t++ ) - hbMakeCodeLengths( len[t], rfreq[t], alphaSize, 20 ); + hbMakeCodeLengths( len[ t ], rfreq[ t ], alphaSize, 20 ); } rfreq = null; @@ -1503,30 +1505,30 @@ while ( h <= 256 ); /* * Compute MTF values for the selectors. */ - char pos[] = new char[N_GROUPS]; + char pos[] = new char[ N_GROUPS ]; char ll_i; char tmp2; char tmp; for( i = 0; i < nGroups; i++ ) - pos[i] = ( char )i; + pos[ i ] = (char)i; for( i = 0; i < nSelectors; i++ ) { - ll_i = selector[i]; + ll_i = selector[ i ]; j = 0; - tmp = pos[j]; + tmp = pos[ j ]; while( ll_i != tmp ) { j++; tmp2 = tmp; - tmp = pos[j]; - pos[j] = tmp2; + tmp = pos[ j ]; + pos[ j ] = tmp2; } - pos[0] = tmp; - selectorMtf[i] = ( char )j; + pos[ 0 ] = tmp; + selectorMtf[ i ] = (char)j; } } - int code[][] = new int[N_GROUPS][MAX_ALPHA_SIZE]; + int code[][] = new int[ N_GROUPS ][ MAX_ALPHA_SIZE ]; /* * Assign actual codes for the tables. @@ -1537,41 +1539,41 @@ while ( h <= 256 ); maxLen = 0; for( i = 0; i < alphaSize; i++ ) { - if( len[t][i] > maxLen ) - maxLen = len[t][i]; - if( len[t][i] < minLen ) - minLen = len[t][i]; + if( len[ t ][ i ] > maxLen ) + maxLen = len[ t ][ i ]; + if( len[ t ][ i ] < minLen ) + minLen = len[ t ][ i ]; } if( maxLen > 20 ) panic(); if( minLen < 1 ) panic(); - hbAssignCodes( code[t], len[t], minLen, maxLen, alphaSize ); + hbAssignCodes( code[ t ], len[ t ], minLen, maxLen, alphaSize ); } { /* * Transmit the mapping table. */ - boolean inUse16[] = new boolean[16]; + boolean inUse16[] = new boolean[ 16 ]; for( i = 0; i < 16; i++ ) { - inUse16[i] = false; + inUse16[ i ] = false; for( j = 0; j < 16; j++ ) - if( inUse[i * 16 + j] ) - inUse16[i] = true; + if( inUse[ i * 16 + j ] ) + inUse16[ i ] = true; } nBytes = bytesOut; for( i = 0; i < 16; i++ ) - if( inUse16[i] ) + if( inUse16[ i ] ) bsW( 1, 1 ); else bsW( 1, 0 ); for( i = 0; i < 16; i++ ) - if( inUse16[i] ) + if( inUse16[ i ] ) for( j = 0; j < 16; j++ ) - if( inUse[i * 16 + j] ) + if( inUse[ i * 16 + j ] ) bsW( 1, 1 ); else bsW( 1, 0 ); @@ -1586,7 +1588,7 @@ while ( h <= 256 ); bsW( 15, nSelectors ); for( i = 0; i < nSelectors; i++ ) { - for( j = 0; j < selectorMtf[i]; j++ ) + for( j = 0; j < selectorMtf[ i ]; j++ ) bsW( 1, 1 ); bsW( 1, 0 ); } @@ -1598,11 +1600,11 @@ while ( h <= 256 ); for( t = 0; t < nGroups; t++ ) { - int curr = len[t][0]; + int curr = len[ t ][ 0 ]; bsW( 5, curr ); for( i = 0; i < alphaSize; i++ ) { - while( curr < len[t][i] ) + while( curr < len[ t ][ i ] ) { bsW( 2, 2 ); curr++; @@ -1610,7 +1612,7 @@ while ( h <= 256 ); * 10 */ } - while( curr > len[t][i] ) + while( curr > len[ t ][ i ] ) { bsW( 2, 3 ); curr--; @@ -1637,8 +1639,8 @@ while ( h <= 256 ); ge = nMTF - 1; for( i = gs; i <= ge; i++ ) { - bsW( len[selector[selCtr]][szptr[i]], - code[selector[selCtr]][szptr[i]] ); + bsW( len[ selector[ selCtr ] ][ szptr[ i ] ], + code[ selector[ selCtr ] ][ szptr[ i ] ] ); } gs = ge + 1; @@ -1662,13 +1664,13 @@ while ( h <= 256 ); return; hp = 0; - while( incs[hp] < bigN ) + while( incs[ hp ] < bigN ) hp++; hp--; for( ; hp >= 0; hp-- ) { - h = incs[hp]; + h = incs[ hp ]; i = lo + h; while( true ) @@ -1678,16 +1680,16 @@ while ( h <= 256 ); */ if( i > hi ) break; - v = zptr[i]; + v = zptr[ i ]; j = i; - while( fullGtU( zptr[j - h] + d, v + d ) ) + while( fullGtU( zptr[ j - h ] + d, v + d ) ) { - zptr[j] = zptr[j - h]; + zptr[ j ] = zptr[ j - h ]; j = j - h; if( j <= ( lo + h - 1 ) ) break; } - zptr[j] = v; + zptr[ j ] = v; i++; /* @@ -1695,16 +1697,16 @@ while ( h <= 256 ); */ if( i > hi ) break; - v = zptr[i]; + v = zptr[ i ]; j = i; - while( fullGtU( zptr[j - h] + d, v + d ) ) + while( fullGtU( zptr[ j - h ] + d, v + d ) ) { - zptr[j] = zptr[j - h]; + zptr[ j ] = zptr[ j - h ]; j = j - h; if( j <= ( lo + h - 1 ) ) break; } - zptr[j] = v; + zptr[ j ] = v; i++; /* @@ -1712,16 +1714,16 @@ while ( h <= 256 ); */ if( i > hi ) break; - v = zptr[i]; + v = zptr[ i ]; j = i; - while( fullGtU( zptr[j - h] + d, v + d ) ) + while( fullGtU( zptr[ j - h ] + d, v + d ) ) { - zptr[j] = zptr[j - h]; + zptr[ j ] = zptr[ j - h ]; j = j - h; if( j <= ( lo + h - 1 ) ) break; } - zptr[j] = v; + zptr[ j ] = v; i++; if( workDone > workLimit && firstAttempt ) @@ -1735,9 +1737,9 @@ while ( h <= 256 ); int temp = 0; while( n > 0 ) { - temp = zptr[p1]; - zptr[p1] = zptr[p2]; - zptr[p2] = temp; + temp = zptr[ p1 ]; + zptr[ p1 ] = zptr[ p2 ]; + zptr[ p2 ] = temp; p1++; p2++; n--; @@ -1749,44 +1751,44 @@ while ( h <= 256 ); { if( last < allowableBlockSize ) { - inUse[currentChar] = true; + inUse[ currentChar ] = true; for( int i = 0; i < runLength; i++ ) { - mCrc.updateCRC( ( char )currentChar ); + mCrc.updateCRC( (char)currentChar ); } - switch ( runLength ) + switch( runLength ) { - case 1: - last++; - block[last + 1] = ( char )currentChar; - break; - case 2: - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - break; - case 3: - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - break; - default: - inUse[runLength - 4] = true; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )currentChar; - last++; - block[last + 1] = ( char )( runLength - 4 ); - break; + case 1: + last++; + block[ last + 1 ] = (char)currentChar; + break; + case 2: + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + break; + case 3: + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + break; + default: + inUse[ runLength - 4 ] = true; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)currentChar; + last++; + block[ last + 1 ] = (char)( runLength - 4 ); + break; } } else diff --git a/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CRC.java b/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CRC.java index f12b482a6..e213673b9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CRC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/bzip2/CRC.java @@ -80,7 +80,7 @@ class CRC 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 - }; + }; int globalCrc; @@ -114,7 +114,7 @@ class CRC int temp = ( globalCrc >> 24 ) ^ inCh; if( temp < 0 ) temp = 256 + temp; - globalCrc = ( globalCrc << 8 ) ^ CRC.crc32Table[temp]; + globalCrc = ( globalCrc << 8 ) ^ CRC.crc32Table[ temp ]; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/mail/MailMessage.java b/proposal/myrmidon/src/todo/org/apache/tools/mail/MailMessage.java index 924296429..6d9aac441 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/mail/MailMessage.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/mail/MailMessage.java @@ -6,16 +6,17 @@ * the LICENSE file. */ package org.apache.tools.mail; + import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.net.InetAddress; import java.net.Socket; -import java.util.Iterator; -import java.util.Hashtable; import java.util.ArrayList; import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; /** * A class to help send SMTP email. This class is an improvement on the @@ -348,7 +349,7 @@ public class MailMessage // Check that the response is one of the valid codes for( int i = 0; i < ok.length; i++ ) { - if( response.startsWith( "" + ok[i] ) ) + if( response.startsWith( "" + ok[ i ] ) ) { return true; } @@ -364,7 +365,7 @@ public class MailMessage socket = new Socket( host, port ); out = new MailPrintStream( new BufferedOutputStream( - socket.getOutputStream() ) ); + socket.getOutputStream() ) ); in = new SmtpResponseReader( socket.getInputStream() ); getReady(); } @@ -387,8 +388,8 @@ public class MailMessage Enumeration e = headers.keys(); while( e.hasMoreElements() ) { - String name = ( String )e.nextElement(); - String value = ( String )headers.get( name ); + String name = (String)e.nextElement(); + String value = (String)headers.get( name ); out.println( name + ": " + value ); } out.println(); @@ -471,6 +472,7 @@ public class MailMessage // This PrintStream subclass makes sure that . becomes .. // per RFC 821. It also ensures that new lines are always \r\n. // + class MailPrintStream extends PrintStream { @@ -506,7 +508,7 @@ class MailPrintStream extends PrintStream { for( int i = 0; i < len; i++ ) { - write( buf[off + i] ); + write( buf[ off + i ] ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/mail/SmtpResponseReader.java b/proposal/myrmidon/src/todo/org/apache/tools/mail/SmtpResponseReader.java index 73f935bfc..cfbcc0091 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/mail/SmtpResponseReader.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/mail/SmtpResponseReader.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.mail; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarBuffer.java b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarBuffer.java index a580a3377..68b8d7fa5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarBuffer.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarBuffer.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.tar; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -137,7 +138,7 @@ public class TarBuffer { for( int i = 0, sz = this.getRecordSize(); i < sz; ++i ) { - if( record[i] != 0 ) + if( record[ i ] != 0 ) { return false; } @@ -165,7 +166,7 @@ public class TarBuffer this.flushBlock(); if( this.outStream != System.out - && this.outStream != System.err ) + && this.outStream != System.err ) { this.outStream.close(); @@ -195,7 +196,7 @@ public class TarBuffer if( this.debug ) { System.err.println( "ReadRecord: recIdx = " + this.currRecIdx - + " blkIdx = " + this.currBlkIdx ); + + " blkIdx = " + this.currBlkIdx ); } if( this.inStream == null ) @@ -211,11 +212,11 @@ public class TarBuffer } } - byte[] result = new byte[this.recordSize]; + byte[] result = new byte[ this.recordSize ]; System.arraycopy( this.blockBuffer, - ( this.currRecIdx * this.recordSize ), result, 0, - this.recordSize ); + ( this.currRecIdx * this.recordSize ), result, 0, + this.recordSize ); this.currRecIdx++; @@ -233,7 +234,7 @@ public class TarBuffer if( this.debug ) { System.err.println( "SkipRecord: recIdx = " + this.currRecIdx - + " blkIdx = " + this.currBlkIdx ); + + " blkIdx = " + this.currBlkIdx ); } if( this.inStream == null ) @@ -264,7 +265,7 @@ public class TarBuffer if( this.debug ) { System.err.println( "WriteRecord: recIdx = " + this.currRecIdx - + " blkIdx = " + this.currBlkIdx ); + + " blkIdx = " + this.currBlkIdx ); } if( this.outStream == null ) @@ -275,9 +276,9 @@ public class TarBuffer if( record.length != this.recordSize ) { throw new IOException( "record to write has length '" - + record.length - + "' which is not the record size of '" - + this.recordSize + "'" ); + + record.length + + "' which is not the record size of '" + + this.recordSize + "'" ); } if( this.currRecIdx >= this.recsPerBlock ) @@ -286,8 +287,8 @@ public class TarBuffer } System.arraycopy( record, 0, this.blockBuffer, - ( this.currRecIdx * this.recordSize ), - this.recordSize ); + ( this.currRecIdx * this.recordSize ), + this.recordSize ); this.currRecIdx++; } @@ -306,7 +307,7 @@ public class TarBuffer if( this.debug ) { System.err.println( "WriteRecord: recIdx = " + this.currRecIdx - + " blkIdx = " + this.currBlkIdx ); + + " blkIdx = " + this.currBlkIdx ); } if( this.outStream == null ) @@ -317,9 +318,9 @@ public class TarBuffer if( ( offset + this.recordSize ) > buf.length ) { throw new IOException( "record has length '" + buf.length - + "' with offset '" + offset - + "' which is less than the record size of '" - + this.recordSize + "'" ); + + "' with offset '" + offset + + "' which is less than the record size of '" + + this.recordSize + "'" ); } if( this.currRecIdx >= this.recsPerBlock ) @@ -328,8 +329,8 @@ public class TarBuffer } System.arraycopy( buf, offset, this.blockBuffer, - ( this.currRecIdx * this.recordSize ), - this.recordSize ); + ( this.currRecIdx * this.recordSize ), + this.recordSize ); this.currRecIdx++; } @@ -370,7 +371,7 @@ public class TarBuffer this.blockSize = blockSize; this.recordSize = recordSize; this.recsPerBlock = ( this.blockSize / this.recordSize ); - this.blockBuffer = new byte[this.blockSize]; + this.blockBuffer = new byte[ this.blockSize ]; if( this.inStream != null ) { @@ -409,7 +410,7 @@ public class TarBuffer while( bytesNeeded > 0 ) { long numBytes = this.inStream.read( this.blockBuffer, offset, - bytesNeeded ); + bytesNeeded ); // // NOTE @@ -437,8 +438,8 @@ public class TarBuffer if( this.debug ) { System.err.println( "ReadBlock: INCOMPLETE READ " - + numBytes + " of " + this.blockSize - + " bytes read." ); + + numBytes + " of " + this.blockSize + + " bytes read." ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarConstants.java b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarConstants.java index 6203d31d1..993447743 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarConstants.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarConstants.java @@ -82,42 +82,42 @@ public interface TarConstants /** * Normal file type. */ - byte LF_NORMAL = ( byte )'0'; + byte LF_NORMAL = (byte)'0'; /** * Link file type. */ - byte LF_LINK = ( byte )'1'; + byte LF_LINK = (byte)'1'; /** * Symbolic link file type. */ - byte LF_SYMLINK = ( byte )'2'; + byte LF_SYMLINK = (byte)'2'; /** * Character device file type. */ - byte LF_CHR = ( byte )'3'; + byte LF_CHR = (byte)'3'; /** * Block device file type. */ - byte LF_BLK = ( byte )'4'; + byte LF_BLK = (byte)'4'; /** * Directory file type. */ - byte LF_DIR = ( byte )'5'; + byte LF_DIR = (byte)'5'; /** * FIFO (pipe) file type. */ - byte LF_FIFO = ( byte )'6'; + byte LF_FIFO = (byte)'6'; /** * Contiguous file type. */ - byte LF_CONTIG = ( byte )'7'; + byte LF_CONTIG = (byte)'7'; /** * The magic tag representing a POSIX tar archive. @@ -137,5 +137,5 @@ public interface TarConstants /** * Identifies the *next* file on the tape as having a long name. */ - byte LF_GNUTYPE_LONGNAME = ( byte )'L'; + byte LF_GNUTYPE_LONGNAME = (byte)'L'; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarEntry.java b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarEntry.java index 7914dd132..e666a7064 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarEntry.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarEntry.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.tar; + import java.io.File; import java.util.Date; @@ -190,8 +191,8 @@ public class TarEntry implements TarConstants char ch2 = name.charAt( 1 ); if( ch2 == ':' - && ( ( ch1 >= 'a' && ch1 <= 'z' ) - || ( ch1 >= 'A' && ch1 <= 'Z' ) ) ) + && ( ( ch1 >= 'a' && ch1 <= 'z' ) + || ( ch1 >= 'A' && ch1 <= 'Z' ) ) ) { name = name.substring( 2 ); } @@ -406,15 +407,15 @@ public class TarEntry implements TarConstants { if( this.file == null || !this.file.isDirectory() ) { - return new TarEntry[0]; + return new TarEntry[ 0 ]; } String[] list = this.file.list(); - TarEntry[] result = new TarEntry[list.length]; + TarEntry[] result = new TarEntry[ list.length ]; for( int i = 0; i < list.length; ++i ) { - result[i] = new TarEntry( new File( this.file, list[i] ) ); + result[ i ] = new TarEntry( new File( this.file, list[ i ] ) ); } return result; @@ -490,7 +491,6 @@ public class TarEntry implements TarConstants return this.size; } - /** * Get this entry's user id. * @@ -549,7 +549,6 @@ public class TarEntry implements TarConstants return false; } - /** * Indicate if this entry is a GNU long name block * @@ -585,19 +584,19 @@ public class TarEntry implements TarConstants this.name = TarUtils.parseName( header, offset, NAMELEN ); offset += NAMELEN; - this.mode = ( int )TarUtils.parseOctal( header, offset, MODELEN ); + this.mode = (int)TarUtils.parseOctal( header, offset, MODELEN ); offset += MODELEN; - this.userId = ( int )TarUtils.parseOctal( header, offset, UIDLEN ); + this.userId = (int)TarUtils.parseOctal( header, offset, UIDLEN ); offset += UIDLEN; - this.groupId = ( int )TarUtils.parseOctal( header, offset, GIDLEN ); + this.groupId = (int)TarUtils.parseOctal( header, offset, GIDLEN ); offset += GIDLEN; this.size = TarUtils.parseOctal( header, offset, SIZELEN ); offset += SIZELEN; this.modTime = TarUtils.parseOctal( header, offset, MODTIMELEN ); offset += MODTIMELEN; - this.checkSum = ( int )TarUtils.parseOctal( header, offset, CHKSUMLEN ); + this.checkSum = (int)TarUtils.parseOctal( header, offset, CHKSUMLEN ); offset += CHKSUMLEN; - this.linkFlag = header[offset++]; + this.linkFlag = header[ offset++ ]; this.linkName = TarUtils.parseName( header, offset, NAMELEN ); offset += NAMELEN; this.magic = TarUtils.parseName( header, offset, MAGICLEN ); @@ -606,9 +605,9 @@ public class TarEntry implements TarConstants offset += UNAMELEN; this.groupName = TarUtils.parseName( header, offset, GNAMELEN ); offset += GNAMELEN; - this.devMajor = ( int )TarUtils.parseOctal( header, offset, DEVLEN ); + this.devMajor = (int)TarUtils.parseOctal( header, offset, DEVLEN ); offset += DEVLEN; - this.devMinor = ( int )TarUtils.parseOctal( header, offset, DEVLEN ); + this.devMinor = (int)TarUtils.parseOctal( header, offset, DEVLEN ); } /** @@ -631,10 +630,10 @@ public class TarEntry implements TarConstants for( int c = 0; c < CHKSUMLEN; ++c ) { - outbuf[offset++] = ( byte )' '; + outbuf[ offset++ ] = (byte)' '; } - outbuf[offset++] = this.linkFlag; + outbuf[ offset++ ] = this.linkFlag; offset = TarUtils.getNameBytes( this.linkName, outbuf, offset, NAMELEN ); offset = TarUtils.getNameBytes( this.magic, outbuf, offset, MAGICLEN ); offset = TarUtils.getNameBytes( this.userName, outbuf, offset, UNAMELEN ); @@ -644,7 +643,7 @@ public class TarEntry implements TarConstants while( offset < outbuf.length ) { - outbuf[offset++] = 0; + outbuf[ offset++ ] = 0; } long checkSum = TarUtils.computeCheckSum( outbuf ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarInputStream.java b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarInputStream.java index 5e340e6ae..feff6a775 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarInputStream.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarInputStream.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.tar; + import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; @@ -48,7 +49,7 @@ public class TarInputStream extends FilterInputStream this.buffer = new TarBuffer( is, blockSize, recordSize ); this.readBuf = null; - this.oneBuf = new byte[1]; + this.oneBuf = new byte[ 1 ]; this.debug = false; this.hasHitEOF = false; } @@ -90,10 +91,10 @@ public class TarInputStream extends FilterInputStream if( this.debug ) { System.err.println( "TarInputStream: SKIP currENTRY '" - + this.currEntry.getName() + "' SZ " - + this.entrySize + " OFF " - + this.entryOffset + " skipping " - + numToSkip + " bytes" ); + + this.currEntry.getName() + "' SZ " + + this.entrySize + " OFF " + + this.entryOffset + " skipping " + + numToSkip + " bytes" ); } if( numToSkip > 0 ) @@ -131,56 +132,56 @@ public class TarInputStream extends FilterInputStream { this.currEntry = new TarEntry( headerBuf ); - if( !( headerBuf[257] == 'u' && headerBuf[258] == 's' - && headerBuf[259] == 't' && headerBuf[260] == 'a' - && headerBuf[261] == 'r' ) ) + if( !( headerBuf[ 257 ] == 'u' && headerBuf[ 258 ] == 's' + && headerBuf[ 259 ] == 't' && headerBuf[ 260 ] == 'a' + && headerBuf[ 261 ] == 'r' ) ) { this.entrySize = 0; this.entryOffset = 0; this.currEntry = null; throw new IOException( "bad header in block " - + this.buffer.getCurrentBlockNum() - + " record " - + this.buffer.getCurrentRecordNum() - + ", " + - "header magic is not 'ustar', but '" - + headerBuf[257] - + headerBuf[258] - + headerBuf[259] - + headerBuf[260] - + headerBuf[261] - + "', or (dec) " - + ( ( int )headerBuf[257] ) - + ", " - + ( ( int )headerBuf[258] ) - + ", " - + ( ( int )headerBuf[259] ) - + ", " - + ( ( int )headerBuf[260] ) - + ", " - + ( ( int )headerBuf[261] ) ); + + this.buffer.getCurrentBlockNum() + + " record " + + this.buffer.getCurrentRecordNum() + + ", " + + "header magic is not 'ustar', but '" + + headerBuf[ 257 ] + + headerBuf[ 258 ] + + headerBuf[ 259 ] + + headerBuf[ 260 ] + + headerBuf[ 261 ] + + "', or (dec) " + + ( (int)headerBuf[ 257 ] ) + + ", " + + ( (int)headerBuf[ 258 ] ) + + ", " + + ( (int)headerBuf[ 259 ] ) + + ", " + + ( (int)headerBuf[ 260 ] ) + + ", " + + ( (int)headerBuf[ 261 ] ) ); } if( this.debug ) { System.err.println( "TarInputStream: SET CURRENTRY '" - + this.currEntry.getName() - + "' size = " - + this.currEntry.getSize() ); + + this.currEntry.getName() + + "' size = " + + this.currEntry.getSize() ); } this.entryOffset = 0; // REVIEW How do we resolve this discrepancy?! - this.entrySize = ( int )this.currEntry.getSize(); + this.entrySize = (int)this.currEntry.getSize(); } if( this.currEntry != null && this.currEntry.isGNULongNameEntry() ) { // read in the name StringBuffer longName = new StringBuffer(); - byte[] buffer = new byte[256]; + byte[] buffer = new byte[ 256 ]; int length = 0; while( ( length = read( buffer ) ) >= 0 ) { @@ -240,7 +241,7 @@ public class TarInputStream extends FilterInputStream public void copyEntryContents( OutputStream out ) throws IOException { - byte[] buf = new byte[32 * 1024]; + byte[] buf = new byte[ 32 * 1024 ]; while( true ) { @@ -260,7 +261,9 @@ public class TarInputStream extends FilterInputStream * * @param markLimit The limit to mark. */ - public void mark( int markLimit ) { } + public void mark( int markLimit ) + { + } /** * Since we do not support marking just yet, we return false. @@ -290,7 +293,7 @@ public class TarInputStream extends FilterInputStream } else { - return ( int )this.oneBuf[0]; + return (int)this.oneBuf[ 0 ]; } } @@ -337,7 +340,7 @@ public class TarInputStream extends FilterInputStream if( this.readBuf != null ) { int sz = ( numToRead > this.readBuf.length ) ? this.readBuf.length - : numToRead; + : numToRead; System.arraycopy( this.readBuf, 0, buf, offset, sz ); @@ -348,7 +351,7 @@ public class TarInputStream extends FilterInputStream else { int newLen = this.readBuf.length - sz; - byte[] newBuf = new byte[newLen]; + byte[] newBuf = new byte[ newLen ]; System.arraycopy( this.readBuf, sz, newBuf, 0, newLen ); @@ -368,7 +371,7 @@ public class TarInputStream extends FilterInputStream { // Unexpected EOF! throw new IOException( "unexpected EOF with " + numToRead - + " bytes unread" ); + + " bytes unread" ); } int sz = numToRead; @@ -378,7 +381,7 @@ public class TarInputStream extends FilterInputStream { System.arraycopy( rec, 0, buf, offset, sz ); - this.readBuf = new byte[recLen - sz]; + this.readBuf = new byte[ recLen - sz ]; System.arraycopy( rec, sz, this.readBuf, 0, recLen - sz ); } @@ -402,7 +405,9 @@ public class TarInputStream extends FilterInputStream /** * Since we do not support marking just yet, we do nothing. */ - public void reset() { } + public void reset() + { + } /** * Skip bytes in the input buffer. This skips bytes in the current entry's @@ -420,13 +425,13 @@ public class TarInputStream extends FilterInputStream // This is horribly inefficient, but it ensures that we // properly skip over bytes via the TarBuffer... // - byte[] skipBuf = new byte[8 * 1024]; + byte[] skipBuf = new byte[ 8 * 1024 ]; - for( int num = numToSkip; num > 0; ) + for( int num = numToSkip; num > 0; ) { int numRead = this.read( skipBuf, 0, - ( num > skipBuf.length ? skipBuf.length - : num ) ); + ( num > skipBuf.length ? skipBuf.length + : num ) ); if( numRead == -1 ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarOutputStream.java b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarOutputStream.java index 92914c329..f60cd3a09 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarOutputStream.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarOutputStream.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.tar; + import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -50,9 +51,9 @@ public class TarOutputStream extends FilterOutputStream this.buffer = new TarBuffer( os, blockSize, recordSize ); this.debug = false; this.assemLen = 0; - this.assemBuf = new byte[recordSize]; - this.recordBuf = new byte[recordSize]; - this.oneBuf = new byte[1]; + this.assemBuf = new byte[ recordSize ]; + this.recordBuf = new byte[ recordSize ]; + this.oneBuf = new byte[ 1 ]; } /** @@ -65,7 +66,6 @@ public class TarOutputStream extends FilterOutputStream this.buffer.setDebug( debug ); } - /** * Sets the debugging flag. * @@ -120,7 +120,7 @@ public class TarOutputStream extends FilterOutputStream { for( int i = this.assemLen; i < this.assemBuf.length; ++i ) { - this.assemBuf[i] = 0; + this.assemBuf[ i ] = 0; } this.buffer.writeRecord( this.assemBuf ); @@ -132,8 +132,8 @@ public class TarOutputStream extends FilterOutputStream if( this.currBytes < this.currSize ) { throw new IOException( "entry closed at '" + this.currBytes - + "' before the '" + this.currSize - + "' bytes specified in the header were written" ); + + "' before the '" + this.currSize + + "' bytes specified in the header were written" ); } } @@ -171,7 +171,7 @@ public class TarOutputStream extends FilterOutputStream // create a TarEntry for the LongLink, the contents // of which are the entry's name TarEntry longLinkEntry = new TarEntry( TarConstants.GNU_LONGLINK, - TarConstants.LF_GNUTYPE_LONGNAME ); + TarConstants.LF_GNUTYPE_LONGNAME ); longLinkEntry.setSize( entry.getName().length() + 1 ); putNextEntry( longLinkEntry ); @@ -182,8 +182,8 @@ public class TarOutputStream extends FilterOutputStream else if( longFileMode != LONGFILE_TRUNCATE ) { throw new RuntimeException( "file name '" + entry.getName() - + "' is too long ( > " - + TarConstants.NAMELEN + " bytes)" ); + + "' is too long ( > " + + TarConstants.NAMELEN + " bytes)" ); } } @@ -198,7 +198,7 @@ public class TarOutputStream extends FilterOutputStream } else { - this.currSize = ( int )entry.getSize(); + this.currSize = (int)entry.getSize(); } } @@ -212,7 +212,7 @@ public class TarOutputStream extends FilterOutputStream public void write( int b ) throws IOException { - this.oneBuf[0] = ( byte )b; + this.oneBuf[ 0 ] = (byte)b; this.write( this.oneBuf, 0, 1 ); } @@ -249,8 +249,8 @@ public class TarOutputStream extends FilterOutputStream if( ( this.currBytes + numToWrite ) > this.currSize ) { throw new IOException( "request to write '" + numToWrite - + "' bytes exceeds size in header of '" - + this.currSize + "' bytes" ); + + "' bytes exceeds size in header of '" + + this.currSize + "' bytes" ); // // We have to deal with assembly!!! // The programmer can be writing little 32 byte chunks for all @@ -267,9 +267,9 @@ public class TarOutputStream extends FilterOutputStream int aLen = this.recordBuf.length - this.assemLen; System.arraycopy( this.assemBuf, 0, this.recordBuf, 0, - this.assemLen ); + this.assemLen ); System.arraycopy( wBuf, wOffset, this.recordBuf, - this.assemLen, aLen ); + this.assemLen, aLen ); this.buffer.writeRecord( this.recordBuf ); this.currBytes += this.recordBuf.length; @@ -280,7 +280,7 @@ public class TarOutputStream extends FilterOutputStream else { System.arraycopy( wBuf, wOffset, this.assemBuf, this.assemLen, - numToWrite ); + numToWrite ); wOffset += numToWrite; this.assemLen += numToWrite; @@ -298,7 +298,7 @@ public class TarOutputStream extends FilterOutputStream if( numToWrite < this.recordBuf.length ) { System.arraycopy( wBuf, wOffset, this.assemBuf, this.assemLen, - numToWrite ); + numToWrite ); this.assemLen += numToWrite; @@ -326,7 +326,7 @@ public class TarOutputStream extends FilterOutputStream { for( int i = 0; i < this.recordBuf.length; ++i ) { - this.recordBuf[i] = 0; + this.recordBuf[ i ] = 0; } this.buffer.writeRecord( this.recordBuf ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarUtils.java b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarUtils.java index 40bf84d59..1d06e6945 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/tar/TarUtils.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/tar/TarUtils.java @@ -30,8 +30,8 @@ public class TarUtils { getOctalBytes( value, buf, offset, length ); - buf[offset + length - 1] = ( byte )' '; - buf[offset + length - 2] = 0; + buf[ offset + length - 1 ] = (byte)' '; + buf[ offset + length - 2 ] = 0; return offset + length; } @@ -47,7 +47,7 @@ public class TarUtils */ public static int getLongOctalBytes( long value, byte[] buf, int offset, int length ) { - byte[] temp = new byte[length + 1]; + byte[] temp = new byte[ length + 1 ]; getOctalBytes( value, temp, 0, length + 1 ); System.arraycopy( temp, 0, buf, offset, length ); @@ -70,12 +70,12 @@ public class TarUtils for( i = 0; i < length && i < name.length(); ++i ) { - buf[offset + i] = ( byte )name.charAt( i ); + buf[ offset + i ] = (byte)name.charAt( i ); } for( ; i < length; ++i ) { - buf[offset + i] = 0; + buf[ offset + i ] = 0; } return offset + length; @@ -92,31 +92,31 @@ public class TarUtils */ public static int getOctalBytes( long value, byte[] buf, int offset, int length ) { - byte[] result = new byte[length]; + byte[] result = new byte[ length ]; int idx = length - 1; - buf[offset + idx] = 0; + buf[ offset + idx ] = 0; --idx; - buf[offset + idx] = ( byte )' '; + buf[ offset + idx ] = (byte)' '; --idx; if( value == 0 ) { - buf[offset + idx] = ( byte )'0'; + buf[ offset + idx ] = (byte)'0'; --idx; } else { for( long val = value; idx >= 0 && val > 0; --idx ) { - buf[offset + idx] = ( byte )( ( byte )'0' + ( byte )( val & 7 ) ); + buf[ offset + idx ] = (byte)( (byte)'0' + (byte)( val & 7 ) ); val = val >> 3; } } for( ; idx >= 0; --idx ) { - buf[offset + idx] = ( byte )' '; + buf[ offset + idx ] = (byte)' '; } return offset + length; @@ -134,7 +134,7 @@ public class TarUtils for( int i = 0; i < buf.length; ++i ) { - sum += 255 & buf[i]; + sum += 255 & buf[ i ]; } return sum; @@ -155,12 +155,12 @@ public class TarUtils for( int i = offset; i < end; ++i ) { - if( header[i] == 0 ) + if( header[ i ] == 0 ) { break; } - result.append( ( char )header[i] ); + result.append( (char)header[ i ] ); } return result; @@ -183,26 +183,26 @@ public class TarUtils for( int i = offset; i < end; ++i ) { - if( header[i] == 0 ) + if( header[ i ] == 0 ) { break; } - if( header[i] == ( byte )' ' || header[i] == '0' ) + if( header[ i ] == (byte)' ' || header[ i ] == '0' ) { if( stillPadding ) { continue; } - if( header[i] == ( byte )' ' ) + if( header[ i ] == (byte)' ' ) { break; } } stillPadding = false; - result = ( result << 3 ) + ( header[i] - '0' ); + result = ( result << 3 ) + ( header[ i ] - '0' ); } return result; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/zip/AsiExtraField.java b/proposal/myrmidon/src/todo/org/apache/tools/zip/AsiExtraField.java index e2e3c9122..d2b11d138 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/zip/AsiExtraField.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/zip/AsiExtraField.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.zip; + import java.util.zip.CRC32; import java.util.zip.ZipException; @@ -79,7 +80,9 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable */ private CRC32 crc = new CRC32(); - public AsiExtraField() { } + public AsiExtraField() + { + } /** * Indicate whether this entry is a directory. @@ -205,17 +208,17 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable public byte[] getLocalFileDataData() { // CRC will be added later - byte[] data = new byte[getLocalFileDataLength().getValue() - 4]; + byte[] data = new byte[ getLocalFileDataLength().getValue() - 4 ]; System.arraycopy( ( new ZipShort( getMode() ) ).getBytes(), 0, data, 0, 2 ); byte[] linkArray = getLinkedFile().getBytes(); System.arraycopy( ( new ZipLong( linkArray.length ) ).getBytes(), - 0, data, 2, 4 ); + 0, data, 2, 4 ); System.arraycopy( ( new ZipShort( getUserId() ) ).getBytes(), - 0, data, 6, 2 ); + 0, data, 6, 2 ); System.arraycopy( ( new ZipShort( getGroupId() ) ).getBytes(), - 0, data, 8, 2 ); + 0, data, 8, 2 ); System.arraycopy( linkArray, 0, data, 10, linkArray.length ); @@ -223,7 +226,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable crc.update( data ); long checksum = crc.getValue(); - byte[] result = new byte[data.length + 4]; + byte[] result = new byte[ data.length + 4 ]; System.arraycopy( ( new ZipLong( checksum ) ).getBytes(), 0, result, 0, 4 ); System.arraycopy( data, 0, result, 4, data.length ); return result; @@ -239,11 +242,11 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable public ZipShort getLocalFileDataLength() { return new ZipShort( 4// CRC - + 2// Mode - + 4// SizDev - + 2// UID - + 2// GID - + getLinkedFile().getBytes().length ); + + 2// Mode + + 4// SizDev + + 2// UID + + 2// GID + + getLinkedFile().getBytes().length ); } /** @@ -304,7 +307,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable { long givenChecksum = ( new ZipLong( data, offset ) ).getValue(); - byte[] tmp = new byte[length - 4]; + byte[] tmp = new byte[ length - 4 ]; System.arraycopy( data, offset + 4, tmp, 0, length - 4 ); crc.reset(); crc.update( tmp ); @@ -312,13 +315,13 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable if( givenChecksum != realChecksum ) { throw new ZipException( "bad CRC checksum " - + Long.toHexString( givenChecksum ) - + " instead of " - + Long.toHexString( realChecksum ) ); + + Long.toHexString( givenChecksum ) + + " instead of " + + Long.toHexString( realChecksum ) ); } int newMode = ( new ZipShort( tmp, 0 ) ).getValue(); - byte[] linkArray = new byte[( int )( new ZipLong( tmp, 2 ) ).getValue()]; + byte[] linkArray = new byte[ (int)( new ZipLong( tmp, 2 ) ).getValue() ]; uid = ( new ZipShort( tmp, 6 ) ).getValue(); gid = ( new ZipShort( tmp, 8 ) ).getValue(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/zip/UnrecognizedExtraField.java b/proposal/myrmidon/src/todo/org/apache/tools/zip/UnrecognizedExtraField.java index 092e1c60b..bcc404863 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/zip/UnrecognizedExtraField.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/zip/UnrecognizedExtraField.java @@ -92,7 +92,7 @@ public class UnrecognizedExtraField implements ZipExtraField public void parseFromLocalFileData( byte[] data, int offset, int length ) { - byte[] tmp = new byte[length]; + byte[] tmp = new byte[ length ]; System.arraycopy( data, offset, tmp, 0, length ); setLocalFileDataData( tmp ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipEntry.java b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipEntry.java index 721c3ca77..99a4620eb 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipEntry.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipEntry.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.zip; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; @@ -120,7 +121,7 @@ public class ZipEntry extends java.util.zip.ZipEntry public ZipEntry( ZipEntry entry ) throws ZipException { - this( ( java.util.zip.ZipEntry )entry ); + this( (java.util.zip.ZipEntry)entry ); setInternalAttributes( entry.getInternalAttributes() ); setExternalAttributes( entry.getExternalAttributes() ); setExtraFields( entry.getExtraFields() ); @@ -142,7 +143,7 @@ public class ZipEntry extends java.util.zip.ZipEntry { setCompressedSizeMethod = java.util.zip.ZipEntry.class.getMethod( "setCompressedSize", - new Class[]{Long.TYPE} ); + new Class[]{Long.TYPE} ); } catch( NoSuchMethodException nse ) { @@ -181,14 +182,14 @@ public class ZipEntry extends java.util.zip.ZipEntry { Throwable nested = ite.getTargetException(); throw new RuntimeException( "Exception setting the compressed size " - + "of " + ze + ": " - + nested.getMessage() ); + + "of " + ze + ": " + + nested.getMessage() ); } catch( Throwable other ) { throw new RuntimeException( "Exception setting the compressed size " - + "of " + ze + ": " - + other.getMessage() ); + + "of " + ze + ": " + + other.getMessage() ); } } @@ -255,7 +256,7 @@ public class ZipEntry extends java.util.zip.ZipEntry extraFields.clear(); for( int i = 0; i < fields.length; i++ ) { - extraFields.add( fields[i] ); + extraFields.add( fields[ i ] ); } setExtra(); } @@ -341,7 +342,7 @@ public class ZipEntry extends java.util.zip.ZipEntry public byte[] getLocalFileDataExtra() { byte[] extra = getExtra(); - return extra != null ? extra : new byte[0]; + return extra != null ? extra : new byte[ 0 ]; } /** @@ -357,7 +358,7 @@ public class ZipEntry extends java.util.zip.ZipEntry boolean done = false; for( int i = 0; !done && i < extraFields.size(); i++ ) { - if( ( ( ZipExtraField )extraFields.get( i ) ).getHeaderId().equals( type ) ) + if( ( (ZipExtraField)extraFields.get( i ) ).getHeaderId().equals( type ) ) { extraFields.set( i, ze ); done = true; @@ -381,7 +382,7 @@ public class ZipEntry extends java.util.zip.ZipEntry ZipEntry e = null; try { - e = new ZipEntry( ( java.util.zip.ZipEntry )super.clone() ); + e = new ZipEntry( (java.util.zip.ZipEntry)super.clone() ); } catch( Exception ex ) { @@ -405,7 +406,7 @@ public class ZipEntry extends java.util.zip.ZipEntry boolean done = false; for( int i = 0; !done && i < extraFields.size(); i++ ) { - if( ( ( ZipExtraField )extraFields.get( i ) ).getHeaderId().equals( type ) ) + if( ( (ZipExtraField)extraFields.get( i ) ).getHeaderId().equals( type ) ) { extraFields.remove( i ); done = true; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipExtraField.java b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipExtraField.java index 534530706..38ad35840 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipExtraField.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipExtraField.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.zip; + import java.util.zip.ZipException; /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipLong.java b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipLong.java index 4b3573770..f5ddc968a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipLong.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipLong.java @@ -50,10 +50,10 @@ public class ZipLong implements Cloneable */ public ZipLong( byte[] bytes, int offset ) { - value = ( bytes[offset + 3] << 24 ) & 0xFF000000l; - value += ( bytes[offset + 2] << 16 ) & 0xFF0000; - value += ( bytes[offset + 1] << 8 ) & 0xFF00; - value += ( bytes[offset] & 0xFF ); + value = ( bytes[ offset + 3 ] << 24 ) & 0xFF000000l; + value += ( bytes[ offset + 2 ] << 16 ) & 0xFF0000; + value += ( bytes[ offset + 1 ] << 8 ) & 0xFF00; + value += ( bytes[ offset ] & 0xFF ); } /** @@ -64,11 +64,11 @@ public class ZipLong implements Cloneable */ public byte[] getBytes() { - byte[] result = new byte[4]; - result[0] = ( byte )( ( value & 0xFF ) ); - result[1] = ( byte )( ( value & 0xFF00 ) >> 8 ); - result[2] = ( byte )( ( value & 0xFF0000 ) >> 16 ); - result[3] = ( byte )( ( value & 0xFF000000l ) >> 24 ); + byte[] result = new byte[ 4 ]; + result[ 0 ] = (byte)( ( value & 0xFF ) ); + result[ 1 ] = (byte)( ( value & 0xFF00 ) >> 8 ); + result[ 2 ] = (byte)( ( value & 0xFF0000 ) >> 16 ); + result[ 3 ] = (byte)( ( value & 0xFF000000l ) >> 24 ); return result; } @@ -96,7 +96,7 @@ public class ZipLong implements Cloneable { return false; } - return value == ( ( ZipLong )o ).getValue(); + return value == ( (ZipLong)o ).getValue(); } /** @@ -107,7 +107,7 @@ public class ZipLong implements Cloneable */ public int hashCode() { - return ( int )value; + return (int)value; } }// ZipLong diff --git a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipOutputStream.java b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipOutputStream.java index 725171a25..b483437b4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipOutputStream.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipOutputStream.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.zip; + import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; +import java.util.ArrayList; import java.util.Date; import java.util.Hashtable; -import java.util.ArrayList; import java.util.zip.CRC32; import java.util.zip.Deflater; import java.util.zip.DeflaterOutputStream; @@ -216,17 +217,17 @@ public class ZipOutputStream extends DeflaterOutputStream return DOS_TIME_MIN; } long value = ( ( year - 1980 ) << 25 ) - | ( month << 21 ) - | ( time.getDate() << 16 ) - | ( time.getHours() << 11 ) - | ( time.getMinutes() << 5 ) - | ( time.getSeconds() >> 1 ); - - byte[] result = new byte[4]; - result[0] = ( byte )( ( value & 0xFF ) ); - result[1] = ( byte )( ( value & 0xFF00 ) >> 8 ); - result[2] = ( byte )( ( value & 0xFF0000 ) >> 16 ); - result[3] = ( byte )( ( value & 0xFF000000l ) >> 24 ); + | ( month << 21 ) + | ( time.getDate() << 16 ) + | ( time.getHours() << 11 ) + | ( time.getMinutes() << 5 ) + | ( time.getSeconds() >> 1 ); + + byte[] result = new byte[ 4 ]; + result[ 0 ] = (byte)( ( value & 0xFF ) ); + result[ 1 ] = (byte)( ( value & 0xFF00 ) >> 8 ); + result[ 2 ] = (byte)( ( value & 0xFF0000 ) >> 16 ); + result[ 3 ] = (byte)( ( value & 0xFF000000l ) >> 24 ); return new ZipLong( result ); } @@ -332,19 +333,19 @@ public class ZipOutputStream extends DeflaterOutputStream if( entry.getCrc() != realCrc ) { throw new ZipException( "bad CRC checksum for entry " - + entry.getName() + ": " - + Long.toHexString( entry.getCrc() ) - + " instead of " - + Long.toHexString( realCrc ) ); + + entry.getName() + ": " + + Long.toHexString( entry.getCrc() ) + + " instead of " + + Long.toHexString( realCrc ) ); } if( entry.getSize() != written - dataStart ) { throw new ZipException( "bad size for entry " - + entry.getName() + ": " - + entry.getSize() - + " instead of " - + ( written - dataStart ) ); + + entry.getName() + ": " + + entry.getSize() + + " instead of " + + ( written - dataStart ) ); } } @@ -372,7 +373,7 @@ public class ZipOutputStream extends DeflaterOutputStream cdOffset = new ZipLong( written ); for( int i = 0; i < entries.size(); i++ ) { - writeCentralFileHeader( ( ZipEntry )entries.get( i ) ); + writeCentralFileHeader( (ZipEntry)entries.get( i ) ); } cdLength = new ZipLong( written - cdOffset.getValue() ); writeCentralDirectoryEnd(); @@ -593,7 +594,7 @@ public class ZipOutputStream extends DeflaterOutputStream written += 4; // relative offset of LFH - out.write( ( ( ZipLong )offsets.get( ze ) ).getBytes() ); + out.write( ( (ZipLong)offsets.get( ze ) ).getBytes() ); written += 4; // file name diff --git a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipShort.java b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipShort.java index b06f040e1..6462bd2a9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipShort.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/zip/ZipShort.java @@ -50,8 +50,8 @@ public class ZipShort implements Cloneable */ public ZipShort( byte[] bytes, int offset ) { - value = ( bytes[offset + 1] << 8 ) & 0xFF00; - value += ( bytes[offset] & 0xFF ); + value = ( bytes[ offset + 1 ] << 8 ) & 0xFF00; + value += ( bytes[ offset ] & 0xFF ); } /** @@ -62,9 +62,9 @@ public class ZipShort implements Cloneable */ public byte[] getBytes() { - byte[] result = new byte[2]; - result[0] = ( byte )( value & 0xFF ); - result[1] = ( byte )( ( value & 0xFF00 ) >> 8 ); + byte[] result = new byte[ 2 ]; + result[ 0 ] = (byte)( value & 0xFF ); + result[ 1 ] = (byte)( ( value & 0xFF00 ) >> 8 ); return result; } @@ -92,7 +92,7 @@ public class ZipShort implements Cloneable { return false; } - return value == ( ( ZipShort )o ).getValue(); + return value == ( (ZipShort)o ).getValue(); } /**