You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2003/12/30 07:50:16 UTC
cvs commit: jakarta-commons-sandbox/io/src/java/org/apache/commons/io EndianUtils.java FileUtils.java FilenameUtils.java HexDump.java IOUtils.java
bayard 2003/12/29 22:50:16
Modified: io/src/java/org/apache/commons/io EndianUtils.java
FileUtils.java FilenameUtils.java HexDump.java
IOUtils.java
Log:
removed lots of finals
Revision Changes Path
1.8 +31 -31 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/EndianUtils.java
Index: EndianUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/EndianUtils.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- EndianUtils.java 27 Nov 2003 06:32:26 -0000 1.7
+++ EndianUtils.java 30 Dec 2003 06:50:16 -0000 1.8
@@ -76,7 +76,7 @@
* @param value value to convert
* @return the converted value
*/
- public static short swapShort( final short value )
+ public static short swapShort( short value )
{
return (short)( ( ( ( value >> 0 ) & 0xff ) << 8 ) +
( ( ( value >> 8 ) & 0xff ) << 0 ) );
@@ -87,7 +87,7 @@
* @param value value to convert
* @return the converted value
*/
- public static int swapInteger( final int value )
+ public static int swapInteger( int value )
{
return
( ( ( value >> 0 ) & 0xff ) << 24 ) +
@@ -101,7 +101,7 @@
* @param value value to convert
* @return the converted value
*/
- public static long swapLong( final long value )
+ public static long swapLong( long value )
{
return
( ( ( value >> 0 ) & 0xff ) << 56 ) +
@@ -119,7 +119,7 @@
* @param value value to convert
* @return the converted value
*/
- public static float swapFloat( final float value )
+ public static float swapFloat( float value )
{
return Float.intBitsToFloat( swapInteger( Float.floatToIntBits( value ) ) );
}
@@ -129,7 +129,7 @@
* @param value value to convert
* @return the converted value
*/
- public static double swapDouble( final double value )
+ public static double swapDouble( double value )
{
return Double.longBitsToDouble( swapLong( Double.doubleToLongBits( value ) ) );
}
@@ -143,7 +143,7 @@
* @param offset starting offset in the byte array
* @param value value to write
*/
- public static void writeSwappedShort( final byte[] data, final int offset, final short value )
+ public static void writeSwappedShort( byte[] data, int offset, short value )
{
data[ offset + 0 ] = (byte)( ( value >> 0 ) & 0xff );
data[ offset + 1 ] = (byte)( ( value >> 8 ) & 0xff );
@@ -156,7 +156,7 @@
* @param offset starting offset in the byte array
* @return the value read
*/
- public static short readSwappedShort( final byte[] data, final int offset )
+ public static short readSwappedShort( byte[] data, int offset )
{
return (short)( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
( ( data[ offset + 1 ] & 0xff ) << 8 ) );
@@ -170,7 +170,7 @@
* @param offset starting offset in the byte array
* @return the value read
*/
- public static int readSwappedUnsignedShort( final byte[] data, final int offset )
+ public static int readSwappedUnsignedShort( byte[] data, int offset )
{
return (int)( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
( ( data[ offset + 1 ] & 0xff ) << 8 ) );
@@ -183,7 +183,7 @@
* @param offset starting offset in the byte array
* @param value value to write
*/
- public static void writeSwappedInteger( final byte[] data, final int offset, final int value )
+ public static void writeSwappedInteger( byte[] data, int offset, int value )
{
data[ offset + 0 ] = (byte)( ( value >> 0 ) & 0xff );
data[ offset + 1 ] = (byte)( ( value >> 8 ) & 0xff );
@@ -198,7 +198,7 @@
* @param offset starting offset in the byte array
* @return the value read
*/
- public static int readSwappedInteger( final byte[] data, final int offset )
+ public static int readSwappedInteger( byte[] data, int offset )
{
return (int)( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
( ( data[ offset + 1 ] & 0xff ) << 8 ) +
@@ -214,7 +214,7 @@
* @param offset starting offset in the byte array
* @return the value read
*/
- public static long readSwappedUnsignedInteger( final byte[] data, final int offset )
+ public static long readSwappedUnsignedInteger( byte[] data, int offset )
{
return (long)( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
( ( data[ offset + 1 ] & 0xff ) << 8 ) +
@@ -229,7 +229,7 @@
* @param offset starting offset in the byte array
* @param value value to write
*/
- public static void writeSwappedLong( final byte[] data, final int offset, final long value )
+ public static void writeSwappedLong( byte[] data, int offset, long value )
{
data[ offset + 0 ] = (byte)( ( value >> 0 ) & 0xff );
data[ offset + 1 ] = (byte)( ( value >> 8 ) & 0xff );
@@ -248,7 +248,7 @@
* @param offset starting offset in the byte array
* @return the value read
*/
- public static long readSwappedLong( final byte[] data, final int offset )
+ public static long readSwappedLong( byte[] data, int offset )
{
long ln = (long)( ( ( data[ offset + 0 ] & 0xff ) << 0 ) );
long low = (long)( ( ( data[ offset + 0 ] & 0xff ) << 0 ) +
@@ -270,7 +270,7 @@
* @param offset starting offset in the byte array
* @param value value to write
*/
- public static void writeSwappedFloat( final byte[] data, final int offset, final float value )
+ public static void writeSwappedFloat( byte[] data, int offset, float value )
{
writeSwappedInteger( data, offset, Float.floatToIntBits( value ) );
}
@@ -282,7 +282,7 @@
* @param offset starting offset in the byte array
* @return the value read
*/
- public static float readSwappedFloat( final byte[] data, final int offset )
+ public static float readSwappedFloat( byte[] data, int offset )
{
return Float.intBitsToFloat( readSwappedInteger( data, offset ) );
}
@@ -294,7 +294,7 @@
* @param offset starting offset in the byte array
* @param value value to write
*/
- public static void writeSwappedDouble( final byte[] data, final int offset, final double value )
+ public static void writeSwappedDouble( byte[] data, int offset, double value )
{
writeSwappedLong( data, offset, Double.doubleToLongBits( value ) );
}
@@ -306,7 +306,7 @@
* @param offset starting offset in the byte array
* @return the value read
*/
- public static double readSwappedDouble( final byte[] data, final int offset )
+ public static double readSwappedDouble( byte[] data, int offset )
{
return Double.longBitsToDouble( readSwappedLong( data, offset ) );
}
@@ -318,7 +318,7 @@
* @param value value to write
* @throws IOException in case of an I/O problem
*/
- public static void writeSwappedShort( final OutputStream output, final short value )
+ public static void writeSwappedShort( OutputStream output, short value )
throws IOException
{
output.write( (byte)( ( value >> 0 ) & 0xff ) );
@@ -332,7 +332,7 @@
* @return the value just read
* @throws IOException in case of an I/O problem
*/
- public static short readSwappedShort( final InputStream input )
+ public static short readSwappedShort( InputStream input )
throws IOException
{
return (short)( ( ( read( input ) & 0xff ) << 0 ) +
@@ -346,7 +346,7 @@
* @return the value just read
* @throws IOException in case of an I/O problem
*/
- public static int readSwappedUnsignedShort( final InputStream input )
+ public static int readSwappedUnsignedShort( InputStream input )
throws IOException
{
final int value1 = read( input );
@@ -363,7 +363,7 @@
* @param value value to write
* @throws IOException in case of an I/O problem
*/
- public static void writeSwappedInteger( final OutputStream output, final int value )
+ public static void writeSwappedInteger( OutputStream output, int value )
throws IOException
{
output.write( (byte)( ( value >> 0 ) & 0xff ) );
@@ -379,7 +379,7 @@
* @return the value just read
* @throws IOException in case of an I/O problem
*/
- public static int readSwappedInteger( final InputStream input )
+ public static int readSwappedInteger( InputStream input )
throws IOException
{
final int value1 = read( input );
@@ -400,7 +400,7 @@
* @return the value just read
* @throws IOException in case of an I/O problem
*/
- public static long readSwappedUnsignedInteger( final InputStream input )
+ public static long readSwappedUnsignedInteger( InputStream input )
throws IOException
{
final int value1 = read( input );
@@ -421,7 +421,7 @@
* @param value value to write
* @throws IOException in case of an I/O problem
*/
- public static void writeSwappedLong( final OutputStream output, final long value )
+ public static void writeSwappedLong( OutputStream output, long value )
throws IOException
{
output.write( (byte)( ( value >> 0 ) & 0xff ) );
@@ -441,7 +441,7 @@
* @return the value just read
* @throws IOException in case of an I/O problem
*/
- public static long readSwappedLong( final InputStream input )
+ public static long readSwappedLong( InputStream input )
throws IOException
{
final int value1 = read( input );
@@ -470,7 +470,7 @@
* @param value value to write
* @throws IOException in case of an I/O problem
*/
- public static void writeSwappedFloat( final OutputStream output, final float value )
+ public static void writeSwappedFloat( OutputStream output, float value )
throws IOException
{
writeSwappedInteger( output, Float.floatToIntBits( value ) );
@@ -483,7 +483,7 @@
* @return the value just read
* @throws IOException in case of an I/O problem
*/
- public static float readSwappedFloat( final InputStream input )
+ public static float readSwappedFloat( InputStream input )
throws IOException
{
return Float.intBitsToFloat( readSwappedInteger( input ) );
@@ -496,7 +496,7 @@
* @param value value to write
* @throws IOException in case of an I/O problem
*/
- public static void writeSwappedDouble( final OutputStream output, final double value )
+ public static void writeSwappedDouble( OutputStream output, double value )
throws IOException
{
writeSwappedLong( output, Double.doubleToLongBits( value ) );
@@ -509,13 +509,13 @@
* @return the value just read
* @throws IOException in case of an I/O problem
*/
- public static double readSwappedDouble( final InputStream input )
+ public static double readSwappedDouble( InputStream input )
throws IOException
{
return Double.longBitsToDouble( readSwappedLong( input ) );
}
- private static int read( final InputStream input )
+ private static int read( InputStream input )
throws IOException
{
final int value = input.read();
1.23 +53 -53 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/FileUtils.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- FileUtils.java 29 Dec 2003 13:14:52 -0000 1.22
+++ FileUtils.java 30 Dec 2003 06:50:16 -0000 1.23
@@ -257,7 +257,7 @@
* @param extensions an array of extensions. Format: {"java", "xml"}
* @return an array of suffixes. Format: {".java", ".xml"}
*/
- private static String[] toSuffixes(final String[] extensions) {
+ private static String[] toSuffixes(String[] extensions) {
String[] suffixes = new String[extensions.length];
for (int i = 0; i < extensions.length; i++) {
suffixes[i] = "." + extensions[i];
@@ -297,9 +297,9 @@
* @return true if the content of the files are equal or they both don't exist, false otherwise
* @throws IOException in case of an I/O error
*/
- public static boolean contentEquals(final File file1, final File file2)
+ public static boolean contentEquals(File file1, File file2)
throws IOException {
- final boolean file1Exists = file1.exists();
+ boolean file1Exists = file1.exists();
if (file1Exists != file2.exists()) {
return false;
}
@@ -333,11 +333,11 @@
* @return The equivalent <code>File</code> object, or <code>null</code> if the URL's protocol
* is not <code>file</code>
*/
- public static File toFile(final URL url) {
+ public static File toFile(URL url) {
if (url.getProtocol().equals("file") == false) {
return null;
} else {
- final String filename =
+ String filename =
url.getFile().replace('/', File.separatorChar);
return new File(filename);
}
@@ -350,8 +350,8 @@
* @return the array of URLs
* @throws IOException if an error occurs
*/
- public static URL[] toURLs(final File[] files) throws IOException {
- final URL[] urls = new URL[files.length];
+ public static URL[] toURLs(File[] files) throws IOException {
+ URL[] urls = new URL[files.length];
for (int i = 0; i < urls.length; i++) {
urls[i] = files[i].toURL();
@@ -375,8 +375,8 @@
* <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying.
*/
public static void copyFileToDirectory(
- final File source,
- final File destinationDirectory)
+ File source,
+ File destinationDirectory)
throws IOException {
if (destinationDirectory.exists()
&& !destinationDirectory.isDirectory()) {
@@ -402,11 +402,11 @@
* @throws FileNotFoundException if <code>destination</code> is a directory
* (use {@link #copyFileToDirectory}).
*/
- public static void copyFile(final File source, final File destination)
+ public static void copyFile(File source, File destination)
throws IOException {
//check source exists
if (!source.exists()) {
- final String message = "File " + source + " does not exist";
+ String message = "File " + source + " does not exist";
throw new FileNotFoundException(message);
}
@@ -418,14 +418,14 @@
//make sure we can write to destination
if (destination.exists() && !destination.canWrite()) {
- final String message =
+ String message =
"Unable to open file " + destination + " for writing.";
throw new IOException(message);
}
- final FileInputStream input = new FileInputStream(source);
+ FileInputStream input = new FileInputStream(source);
try {
- final FileOutputStream output = new FileOutputStream(destination);
+ FileOutputStream output = new FileOutputStream(destination);
try {
CopyUtils.copy(input, output);
} finally {
@@ -436,7 +436,7 @@
}
if (source.length() != destination.length()) {
- final String message =
+ String message =
"Failed to copy full contents from "
+ source
+ " to "
@@ -461,7 +461,7 @@
* <li>an IO error occurs during copying</li>
* </ul>
*/
- public static void copyURLToFile(final URL source, final File destination)
+ public static void copyURLToFile(URL source, File destination)
throws IOException {
//does destination directory exist ?
if (destination.getParentFile() != null
@@ -471,14 +471,14 @@
//make sure we can write to destination
if (destination.exists() && !destination.canWrite()) {
- final String message =
+ String message =
"Unable to open file " + destination + " for writing.";
throw new IOException(message);
}
- final InputStream input = source.openStream();
+ InputStream input = source.openStream();
try {
- final FileOutputStream output = new FileOutputStream(destination);
+ FileOutputStream output = new FileOutputStream(destination);
try {
CopyUtils.copy(input, output);
} finally {
@@ -495,7 +495,7 @@
* @param directory directory to delete
* @throws IOException in case deletion is unsuccessful
*/
- public static void deleteDirectory(final File directory)
+ public static void deleteDirectory(File directory)
throws IOException {
if (!directory.exists()) {
return;
@@ -503,7 +503,7 @@
cleanDirectory(directory);
if (!directory.delete()) {
- final String message =
+ String message =
"Unable to delete directory " + directory + ".";
throw new IOException(message);
}
@@ -514,26 +514,26 @@
* @param directory directory to clean
* @throws IOException in case cleaning is unsuccessful
*/
- public static void cleanDirectory(final File directory)
+ public static void cleanDirectory(File directory)
throws IOException {
if (!directory.exists()) {
- final String message = directory + " does not exist";
+ String message = directory + " does not exist";
throw new IllegalArgumentException(message);
}
if (!directory.isDirectory()) {
- final String message = directory + " is not a directory";
+ String message = directory + " is not a directory";
throw new IllegalArgumentException(message);
}
IOException exception = null;
- final File[] files = directory.listFiles();
+ File[] files = directory.listFiles();
for (int i = 0; i < files.length; i++) {
- final File file = files[i];
+ File file = files[i];
try {
forceDelete(file);
- } catch (final IOException ioe) {
+ } catch (IOException ioe) {
exception = ioe;
}
}
@@ -552,7 +552,7 @@
* TODO Needs a clearer javadoc to see its real purpose for someone without
* NFS-knowledge.
*/
- public static boolean waitFor(final File file, final int seconds) {
+ public static boolean waitFor(File file, int seconds) {
int timeout = 0;
int tick = 0;
while (!file.exists()) {
@@ -590,7 +590,7 @@
* by the VM
*/
public static String readFileToString(
- final File file, final String encoding) throws IOException {
+ File file, String encoding) throws IOException {
InputStream in = new java.io.FileInputStream(file);
try {
return IOUtils.toString(in, encoding);
@@ -615,8 +615,8 @@
* @throws UnsupportedEncodingException if the encoding is not supported
* by the VM
*/
- public static void writeStringToFile(final File file,
- final String data, final String encoding) throws IOException {
+ public static void writeStringToFile(File file,
+ String data, String encoding) throws IOException {
OutputStream out = new java.io.FileOutputStream(file);
try {
out.write(data.getBytes(encoding));
@@ -640,7 +640,7 @@
* @param file file or directory to delete.
* @throws IOException in case deletion is unsuccessful
*/
- public static void forceDelete(final File file) throws IOException {
+ public static void forceDelete(File file) throws IOException {
if (file.isDirectory()) {
deleteDirectory(file);
} else {
@@ -648,7 +648,7 @@
throw new FileNotFoundException("File does not exist: " + file);
}
if (!file.delete()) {
- final String message =
+ String message =
"Unable to delete file: " + file;
throw new IOException(message);
}
@@ -661,7 +661,7 @@
* @param file file or directory to delete.
* @throws IOException in case deletion is unsuccessful
*/
- public static void forceDeleteOnExit(final File file) throws IOException {
+ public static void forceDeleteOnExit(File file) throws IOException {
if (file.isDirectory()) {
deleteDirectoryOnExit(file);
} else {
@@ -674,7 +674,7 @@
* @param directory directory to delete.
* @throws IOException in case deletion is unsuccessful
*/
- private static void deleteDirectoryOnExit(final File directory)
+ private static void deleteDirectoryOnExit(File directory)
throws IOException {
if (!directory.exists()) {
return;
@@ -689,26 +689,26 @@
* @param directory directory to clean.
* @throws IOException in case cleaning is unsuccessful
*/
- private static void cleanDirectoryOnExit(final File directory)
+ private static void cleanDirectoryOnExit(File directory)
throws IOException {
if (!directory.exists()) {
- final String message = directory + " does not exist";
+ String message = directory + " does not exist";
throw new IllegalArgumentException(message);
}
if (!directory.isDirectory()) {
- final String message = directory + " is not a directory";
+ String message = directory + " is not a directory";
throw new IllegalArgumentException(message);
}
IOException exception = null;
- final File[] files = directory.listFiles();
+ File[] files = directory.listFiles();
for (int i = 0; i < files.length; i++) {
- final File file = files[i];
+ File file = files[i];
try {
forceDeleteOnExit(file);
- } catch (final IOException ioe) {
+ } catch (IOException ioe) {
exception = ioe;
}
}
@@ -725,10 +725,10 @@
* @param directory directory to create
* @throws IOException if the directory cannot be created.
*/
- public static void forceMkdir(final File directory) throws IOException {
+ public static void forceMkdir(File directory) throws IOException {
if (directory.exists()) {
if (directory.isFile()) {
- final String message =
+ String message =
"File "
+ directory
+ " exists and is "
@@ -737,7 +737,7 @@
}
} else {
if (false == directory.mkdirs()) {
- final String message =
+ String message =
"Unable to create directory " + directory;
throw new IOException(message);
}
@@ -750,22 +750,22 @@
* @param directory directory to inspect
* @return size of directory in bytes.
*/
- public static long sizeOfDirectory(final File directory) {
+ public static long sizeOfDirectory(File directory) {
if (!directory.exists()) {
- final String message = directory + " does not exist";
+ String message = directory + " does not exist";
throw new IllegalArgumentException(message);
}
if (!directory.isDirectory()) {
- final String message = directory + " is not a directory";
+ String message = directory + " is not a directory";
throw new IllegalArgumentException(message);
}
long size = 0;
- final File[] files = directory.listFiles();
+ File[] files = directory.listFiles();
for (int i = 0; i < files.length; i++) {
- final File file = files[i];
+ File file = files[i];
if (file.isDirectory()) {
size += sizeOfDirectory(file);
@@ -787,7 +787,7 @@
* @return true if the <code>File</code> exists and has been modified more recently
* than the reference <code>File</code>.
*/
- public static boolean isFileNewer(final File file, final File reference) {
+ public static boolean isFileNewer(File file, File reference) {
if (reference == null) {
throw new IllegalArgumentException("No specified reference file");
}
@@ -807,7 +807,7 @@
* @return true if the <code>File</code> exists and has been modified after
* the given <code>Date</code>.
*/
- public static boolean isFileNewer(final File file, final Date date) {
+ public static boolean isFileNewer(File file, Date date) {
if (date == null) {
throw new IllegalArgumentException("No specified date");
}
@@ -824,7 +824,7 @@
* @return true if the <code>File</code> exists and has been modified after
* the given time reference.
*/
- public static boolean isFileNewer(final File file, final long timeMillis) {
+ public static boolean isFileNewer(File file, long timeMillis) {
if (file == null) {
throw new IllegalArgumentException("No specified file");
}
1.4 +27 -27 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/FilenameUtils.java
Index: FilenameUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/FilenameUtils.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FilenameUtils.java 29 Dec 2003 05:59:18 -0000 1.3
+++ FilenameUtils.java 30 Dec 2003 06:50:16 -0000 1.4
@@ -127,8 +127,8 @@
* @param filename the filename
* @return the filename minus extension
*/
- public static String removeExtension(final String filename) {
- final int index = filename.lastIndexOf('.');
+ public static String removeExtension( String filename) {
+ int index = filename.lastIndexOf('.');
if (-1 == index) {
return filename;
@@ -149,8 +149,8 @@
* @param filename the filename
* @return the extension of filename or "" if none
*/
- public static String getExtension(final String filename) {
- final int index = filename.lastIndexOf('.');
+ public static String getExtension( String filename) {
+ int index = filename.lastIndexOf('.');
if (-1 == index) {
return "";
@@ -170,7 +170,7 @@
* @param filepath the filepath
* @return the filename minus path
*/
- public static String removePath(final String filepath) {
+ public static String removePath( String filepath) {
return removePath(filepath, File.separatorChar);
}
@@ -187,9 +187,9 @@
* @return the filename minus path
*/
public static String removePath(
- final String filepath,
- final char fileSeparatorChar) {
- final int index = filepath.lastIndexOf(fileSeparatorChar);
+ String filepath,
+ char fileSeparatorChar) {
+ int index = filepath.lastIndexOf(fileSeparatorChar);
if (-1 == index) {
return filepath;
@@ -209,7 +209,7 @@
* @param filepath the filepath
* @return the filename minus path
*/
- public static String getPath(final String filepath) {
+ public static String getPath( String filepath) {
return getPath(filepath, File.separatorChar);
}
@@ -226,9 +226,9 @@
* @return the filename minus path
*/
public static String getPath(
- final String filepath,
- final char fileSeparatorChar) {
- final int index = filepath.lastIndexOf(fileSeparatorChar);
+ String filepath,
+ char fileSeparatorChar) {
+ int index = filepath.lastIndexOf(fileSeparatorChar);
if (-1 == index) {
return "";
} else {
@@ -256,7 +256,7 @@
* @param path the path to normalize
* @return the normalized String, or <code>null</code> if too many ..'s.
*/
- public static String normalize(final String path) {
+ public static String normalize( String path) {
String normalized = path;
// Resolve occurrences of "//" in the normalized path
while (true) {
@@ -307,7 +307,7 @@
*
* @return The concatenated paths, or null if error occurs
*/
- public static String catPath(final String lookupPath, final String path) {
+ public static String catPath( String lookupPath, String path) {
// Cut off the last slash and everything beyond
int index = lookupPath.lastIndexOf("/");
String lookup = lookupPath.substring(0, index);
@@ -340,7 +340,7 @@
* @param filename Absolute or relative file path to resolve.
* @return The canonical <code>File</code> of <code>filename</code>.
*/
- public static File resolveFile(final File baseFile, String filename) {
+ public static File resolveFile( File baseFile, String filename) {
String filenm = filename;
if ('/' != File.separatorChar) {
filenm = filename.replace('/', File.separatorChar);
@@ -356,14 +356,14 @@
try {
file = file.getCanonicalFile();
- } catch (final IOException ioe) {}
+ } catch ( IOException ioe) {}
return file;
}
// FIXME: I'm almost certain this // removal is unnecessary, as getAbsoluteFile() strips
// them. However, I'm not sure about this UNC stuff. (JT)
- final char[] chars = filename.toCharArray();
- final StringBuffer sb = new StringBuffer();
+ char[] chars = filename.toCharArray();
+ StringBuffer sb = new StringBuffer();
//remove duplicate file separators in succession - except
//on win32 at start of filename as UNC filenames can
@@ -375,7 +375,7 @@
}
for (int i = start; i < chars.length; i++) {
- final boolean doubleSeparator =
+ boolean doubleSeparator =
File.separatorChar == chars[i]
&& File.separatorChar == chars[i - 1];
@@ -391,7 +391,7 @@
try {
file = file.getCanonicalFile();
- } catch (final IOException ioe) {}
+ } catch ( IOException ioe) {}
return file;
}
@@ -445,7 +445,7 @@
* @throws IOException in case deletion is unsuccessful
* @deprecated Use {@link FileUtils#forceDelete(File)}
*/
- public static void forceDelete(final String file) throws IOException {
+ public static void forceDelete( String file) throws IOException {
FileUtils.forceDelete(new File(file));
}
@@ -457,7 +457,7 @@
* @throws IOException in case cleaning is unsuccessful
* @deprecated Use {@link FileUtils#cleanDirectory(File)}
*/
- public static void cleanDirectory(final String directory)
+ public static void cleanDirectory( String directory)
throws IOException {
FileUtils.cleanDirectory(new File(directory));
}
@@ -469,7 +469,7 @@
* @return size of directory in bytes.
* @deprecated Use {@link FileUtils#sizeOfDirectory(File)}
*/
- public static long sizeOfDirectory(final String directory) {
+ public static long sizeOfDirectory( String directory) {
return FileUtils.sizeOfDirectory(new File(directory));
}
@@ -489,8 +489,8 @@
* @deprecated Use {@link FileUtils#copyFileToDirectory(File, File)}
*/
public static void copyFileToDirectory(
- final String source,
- final String destinationDirectory)
+ String source,
+ String destinationDirectory)
throws IOException {
FileUtils.copyFileToDirectory(new File(source), new File(destinationDirectory));
}
@@ -501,7 +501,7 @@
* @throws IOException in case deletion is unsuccessful
* @deprecated Use {@link FileUtils#deleteDirectory(File)}
*/
- public static void deleteDirectory(final String directory)
+ public static void deleteDirectory( String directory)
throws IOException {
FileUtils.deleteDirectory(new File(directory));
}
1.5 +8 -8 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/HexDump.java
Index: HexDump.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/HexDump.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HexDump.java 13 Oct 2003 07:04:52 -0000 1.4
+++ HexDump.java 30 Dec 2003 06:50:16 -0000 1.5
@@ -91,8 +91,8 @@
* null
*/
- public static void dump(final byte[] data, final long offset,
- final OutputStream stream, final int index)
+ public static void dump(byte[] data, long offset,
+ OutputStream stream, int index)
throws IOException, ArrayIndexOutOfBoundsException,
IllegalArgumentException {
if ((index < 0) || (index >= data.length)) {
@@ -151,7 +151,7 @@
28, 24, 20, 16, 12, 8, 4, 0
};
- private static StringBuffer dump(final long value) {
+ private static StringBuffer dump(long value) {
_lbuffer.setLength(0);
for (int j = 0; j < 8; j++) {
_lbuffer
@@ -160,7 +160,7 @@
return _lbuffer;
}
- private static StringBuffer dump(final byte value) {
+ private static StringBuffer dump(byte value) {
_cbuffer.setLength(0);
for (int j = 0; j < 2; j++) {
_cbuffer.append(_hexcodes[(value >> _shifts[j + 6]) & 15]);
1.9 +81 -81 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/IOUtils.java
Index: IOUtils.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/IOUtils.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- IOUtils.java 29 Dec 2003 03:28:53 -0000 1.8
+++ IOUtils.java 30 Dec 2003 06:50:16 -0000 1.9
@@ -162,7 +162,7 @@
*
* @param input A (possibly null) Reader
*/
- public static void closeQuietly( final Reader input )
+ public static void closeQuietly( Reader input )
{
if( input == null )
{
@@ -173,7 +173,7 @@
{
input.close();
}
- catch( final IOException ioe )
+ catch( IOException ioe )
{
}
}
@@ -184,7 +184,7 @@
*
* @param output A (possibly null) Writer
*/
- public static void closeQuietly( final Writer output )
+ public static void closeQuietly( Writer output )
{
if( output == null )
{
@@ -195,7 +195,7 @@
{
output.close();
}
- catch( final IOException ioe )
+ catch( IOException ioe )
{
}
}
@@ -205,7 +205,7 @@
* Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored.
* @param output A (possibly null) OutputStream
*/
- public static void closeQuietly( final OutputStream output )
+ public static void closeQuietly( OutputStream output )
{
if( output == null )
{
@@ -216,7 +216,7 @@
{
output.close();
}
- catch( final IOException ioe )
+ catch( IOException ioe )
{
}
}
@@ -226,7 +226,7 @@
* Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
* @param input A (possibly null) InputStream
*/
- public static void closeQuietly( final InputStream input )
+ public static void closeQuietly( InputStream input )
{
if( input == null )
{
@@ -237,7 +237,7 @@
{
input.close();
}
- catch( final IOException ioe )
+ catch( IOException ioe )
{
}
}
@@ -254,7 +254,7 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(InputStream, OutputStream)}
*/
- public static int copy( final InputStream input, final OutputStream output )
+ public static int copy( InputStream input, OutputStream output )
throws IOException
{
return copy( input, output, DEFAULT_BUFFER_SIZE );
@@ -269,12 +269,12 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(InputStream, OutputStream, int)}
*/
- public static int copy( final InputStream input,
- final OutputStream output,
- final int bufferSize )
+ public static int copy( InputStream input,
+ OutputStream output,
+ int bufferSize )
throws IOException
{
- final byte[] buffer = new byte[ bufferSize ];
+ byte[] buffer = new byte[ bufferSize ];
int count = 0;
int n = 0;
while( -1 != ( n = input.read( buffer ) ) )
@@ -293,7 +293,7 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(Reader, Writer)}
*/
- public static int copy( final Reader input, final Writer output )
+ public static int copy( Reader input, Writer output )
throws IOException
{
return copy( input, output, DEFAULT_BUFFER_SIZE );
@@ -308,10 +308,10 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(Reader, Writer, int)}
*/
- public static int copy( final Reader input, final Writer output, final int bufferSize )
+ public static int copy( Reader input, Writer output, int bufferSize )
throws IOException
{
- final char[] buffer = new char[ bufferSize ];
+ char[] buffer = new char[ bufferSize ];
int count = 0;
int n = 0;
while( -1 != ( n = input.read( buffer ) ) )
@@ -340,7 +340,7 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(InputStream, Writer)}
*/
- public static void copy( final InputStream input, final Writer output )
+ public static void copy( InputStream input, Writer output )
throws IOException
{
copy( input, output, DEFAULT_BUFFER_SIZE );
@@ -356,10 +356,10 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(InputStream, Writer, int)}
*/
- public static void copy( final InputStream input, final Writer output, final int bufferSize )
+ public static void copy( InputStream input, Writer output, int bufferSize )
throws IOException
{
- final InputStreamReader in = new InputStreamReader( input );
+ InputStreamReader in = new InputStreamReader( input );
copy( in, output, bufferSize );
}
@@ -374,10 +374,10 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(InputStream, Writer, String)}
*/
- public static void copy( final InputStream input, final Writer output, final String encoding )
+ public static void copy( InputStream input, Writer output, String encoding )
throws IOException
{
- final InputStreamReader in = new InputStreamReader( input, encoding );
+ InputStreamReader in = new InputStreamReader( input, encoding );
copy( in, output );
}
@@ -393,13 +393,13 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(InputStream, Writer, String, int)}
*/
- public static void copy( final InputStream input,
- final Writer output,
- final String encoding,
- final int bufferSize )
+ public static void copy( InputStream input,
+ Writer output,
+ String encoding,
+ int bufferSize )
throws IOException
{
- final InputStreamReader in = new InputStreamReader( input, encoding );
+ InputStreamReader in = new InputStreamReader( input, encoding );
copy( in, output, bufferSize );
}
@@ -414,7 +414,7 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final InputStream input )
+ public static String toString( InputStream input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
@@ -428,10 +428,10 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final InputStream input, final int bufferSize )
+ public static String toString( InputStream input, int bufferSize )
throws IOException
{
- final StringWriter sw = new StringWriter();
+ StringWriter sw = new StringWriter();
copy( input, sw, bufferSize );
return sw.toString();
}
@@ -445,7 +445,7 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final InputStream input, final String encoding )
+ public static String toString( InputStream input, String encoding )
throws IOException
{
return toString( input, encoding, DEFAULT_BUFFER_SIZE );
@@ -461,12 +461,12 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final InputStream input,
- final String encoding,
- final int bufferSize )
+ public static String toString( InputStream input,
+ String encoding,
+ int bufferSize )
throws IOException
{
- final StringWriter sw = new StringWriter();
+ StringWriter sw = new StringWriter();
copy( input, sw, encoding, bufferSize );
return sw.toString();
}
@@ -480,7 +480,7 @@
* @return the requested byte array
* @throws IOException In case of an I/O problem
*/
- public static byte[] toByteArray( final InputStream input )
+ public static byte[] toByteArray( InputStream input )
throws IOException
{
return toByteArray( input, DEFAULT_BUFFER_SIZE );
@@ -493,10 +493,10 @@
* @return the requested byte array
* @throws IOException In case of an I/O problem
*/
- public static byte[] toByteArray( final InputStream input, final int bufferSize )
+ public static byte[] toByteArray( InputStream input, int bufferSize )
throws IOException
{
- final ByteArrayOutputStream output = new ByteArrayOutputStream();
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
copy( input, output, bufferSize );
return output.toByteArray();
}
@@ -517,7 +517,7 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(Reader, OutputStream)}
*/
- public static void copy( final Reader input, final OutputStream output )
+ public static void copy( Reader input, OutputStream output )
throws IOException
{
copy( input, output, DEFAULT_BUFFER_SIZE );
@@ -532,10 +532,10 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(Reader, OutputStream, int)}
*/
- public static void copy( final Reader input, final OutputStream output, final int bufferSize )
+ public static void copy( Reader input, OutputStream output, int bufferSize )
throws IOException
{
- final OutputStreamWriter out = new OutputStreamWriter( output );
+ OutputStreamWriter out = new OutputStreamWriter( output );
copy( input, out, bufferSize );
// NOTE: Unless anyone is planning on rewriting OutputStreamWriter, we have to flush
// here.
@@ -550,7 +550,7 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final Reader input )
+ public static String toString( Reader input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
@@ -563,10 +563,10 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final Reader input, final int bufferSize )
+ public static String toString( Reader input, int bufferSize )
throws IOException
{
- final StringWriter sw = new StringWriter();
+ StringWriter sw = new StringWriter();
copy( input, sw, bufferSize );
return sw.toString();
}
@@ -580,7 +580,7 @@
* @return the requested byte array
* @throws IOException In case of an I/O problem
*/
- public static byte[] toByteArray( final Reader input )
+ public static byte[] toByteArray( Reader input )
throws IOException
{
return toByteArray( input, DEFAULT_BUFFER_SIZE );
@@ -593,7 +593,7 @@
* @return the requested byte array
* @throws IOException In case of an I/O problem
*/
- public static byte[] toByteArray( final Reader input, final int bufferSize )
+ public static byte[] toByteArray( Reader input, int bufferSize )
throws IOException
{
ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -619,7 +619,7 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(String, OutputStream)}
*/
- public static void copy( final String input, final OutputStream output )
+ public static void copy( String input, OutputStream output )
throws IOException
{
copy( input, output, DEFAULT_BUFFER_SIZE );
@@ -634,11 +634,11 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(String, OutputStream, int)}
*/
- public static void copy( final String input, final OutputStream output, final int bufferSize )
+ public static void copy( String input, OutputStream output, int bufferSize )
throws IOException
{
- final StringReader in = new StringReader( input );
- final OutputStreamWriter out = new OutputStreamWriter( output );
+ StringReader in = new StringReader( input );
+ OutputStreamWriter out = new OutputStreamWriter( output );
copy( in, out, bufferSize );
// NOTE: Unless anyone is planning on rewriting OutputStreamWriter, we have to flush
// here.
@@ -657,7 +657,7 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(String, Writer)}
*/
- public static void copy( final String input, final Writer output )
+ public static void copy( String input, Writer output )
throws IOException
{
output.write( input );
@@ -671,7 +671,7 @@
* @return the requested byte array
* @throws IOException In case of an I/O problem
*/
- public static byte[] toByteArray( final String input )
+ public static byte[] toByteArray( String input )
throws IOException
{
return toByteArray( input, DEFAULT_BUFFER_SIZE );
@@ -684,7 +684,7 @@
* @return the requested byte array
* @throws IOException In case of an I/O problem
*/
- public static byte[] toByteArray( final String input, final int bufferSize )
+ public static byte[] toByteArray( String input, int bufferSize )
throws IOException
{
ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -712,7 +712,7 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(byte[], Writer)}
*/
- public static void copy( final byte[] input, final Writer output )
+ public static void copy( byte[] input, Writer output )
throws IOException
{
copy( input, output, DEFAULT_BUFFER_SIZE );
@@ -728,10 +728,10 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(byte[], Writer, int)}
*/
- public static void copy( final byte[] input, final Writer output, final int bufferSize )
+ public static void copy( byte[] input, Writer output, int bufferSize )
throws IOException
{
- final ByteArrayInputStream in = new ByteArrayInputStream( input );
+ ByteArrayInputStream in = new ByteArrayInputStream( input );
copy( in, output, bufferSize );
}
@@ -746,10 +746,10 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(byte[], Writer, String)}
*/
- public static void copy( final byte[] input, final Writer output, final String encoding )
+ public static void copy( byte[] input, Writer output, String encoding )
throws IOException
{
- final ByteArrayInputStream in = new ByteArrayInputStream( input );
+ ByteArrayInputStream in = new ByteArrayInputStream( input );
copy( in, output, encoding );
}
@@ -765,13 +765,13 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(byte[], Writer, String, int)}
*/
- public static void copy( final byte[] input,
- final Writer output,
- final String encoding,
- final int bufferSize )
+ public static void copy( byte[] input,
+ Writer output,
+ String encoding,
+ int bufferSize )
throws IOException
{
- final ByteArrayInputStream in = new ByteArrayInputStream( input );
+ ByteArrayInputStream in = new ByteArrayInputStream( input );
copy( in, output, encoding, bufferSize );
}
@@ -786,7 +786,7 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final byte[] input )
+ public static String toString( byte[] input )
throws IOException
{
return toString( input, DEFAULT_BUFFER_SIZE );
@@ -800,10 +800,10 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final byte[] input, final int bufferSize )
+ public static String toString( byte[] input, int bufferSize )
throws IOException
{
- final StringWriter sw = new StringWriter();
+ StringWriter sw = new StringWriter();
copy( input, sw, bufferSize );
return sw.toString();
}
@@ -817,7 +817,7 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final byte[] input, final String encoding )
+ public static String toString( byte[] input, String encoding )
throws IOException
{
return toString( input, encoding, DEFAULT_BUFFER_SIZE );
@@ -833,12 +833,12 @@
* @return the requested <code>String</code>
* @throws IOException In case of an I/O problem
*/
- public static String toString( final byte[] input,
- final String encoding,
- final int bufferSize )
+ public static String toString( byte[] input,
+ String encoding,
+ int bufferSize )
throws IOException
{
- final StringWriter sw = new StringWriter();
+ StringWriter sw = new StringWriter();
copy( input, sw, encoding, bufferSize );
return sw.toString();
}
@@ -854,7 +854,7 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(byte[], OutputStream)}
*/
- public static void copy( final byte[] input, final OutputStream output )
+ public static void copy( byte[] input, OutputStream output )
throws IOException
{
copy( input, output, DEFAULT_BUFFER_SIZE );
@@ -868,9 +868,9 @@
* @throws IOException In case of an I/O problem
* @deprecated Replaced by {@link CopyUtils#copy(byte[], OutputStream, int)}
*/
- public static void copy( final byte[] input,
- final OutputStream output,
- final int bufferSize )
+ public static void copy( byte[] input,
+ OutputStream output,
+ int bufferSize )
throws IOException
{
output.write( input );
@@ -884,17 +884,17 @@
* @return true if the content of the streams are equal or they both don't exist, false otherwise
* @throws IOException In case of an I/O problem
*/
- public static boolean contentEquals( final InputStream input1,
- final InputStream input2 )
+ public static boolean contentEquals( InputStream input1,
+ InputStream input2 )
throws IOException
{
- final InputStream bufferedInput1 = new BufferedInputStream( input1 );
- final InputStream bufferedInput2 = new BufferedInputStream( input2 );
+ InputStream bufferedInput1 = new BufferedInputStream( input1 );
+ InputStream bufferedInput2 = new BufferedInputStream( input2 );
int ch = bufferedInput1.read();
while( -1 != ch )
{
- final int ch2 = bufferedInput2.read();
+ int ch2 = bufferedInput2.read();
if( ch != ch2 )
{
return false;
@@ -902,7 +902,7 @@
ch = bufferedInput1.read();
}
- final int ch2 = bufferedInput2.read();
+ int ch2 = bufferedInput2.read();
if( -1 != ch2 )
{
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org