donaldp 01/12/29 15:48:36
Modified: proposal/myrmidon/src/main/org/apache/tools/ant/util
FileUtils.java
Log:
Move contentEquals method into FixCRLF as it is not used anywhere else
Revision Changes Path
1.10 +4 -87
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FileUtils.java 23 Dec 2001 06:32:30 -0000 1.9
+++ FileUtils.java 29 Dec 2001 23:48:36 -0000 1.10
@@ -30,104 +30,21 @@
* @author [EMAIL PROTECTED]
* @author <a href="mailto:[EMAIL PROTECTED]">Conor MacNeill</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class FileUtils
{
/**
- * Compares the contents of two files.
- *
- * @param f1 Description of Parameter
- * @param f2 Description of Parameter
- * @return Description of the Returned Value
- * @exception IOException Description of Exception
- * @since 1.9
- */
- public static boolean contentEquals( File f1, File f2 )
- throws IOException
- {
- if( f1.exists() != f2.exists() )
- {
- return false;
- }
-
- if( !f1.exists() )
- {
- // two not existing files are equal
- return true;
- }
-
- if( f1.isDirectory() || f2.isDirectory() )
- {
- // don't want to compare directory contents for now
- return false;
- }
-
- InputStream in1 = null;
- InputStream in2 = null;
- try
- {
- in1 = new BufferedInputStream( new FileInputStream( f1 ) );
- in2 = new BufferedInputStream( new FileInputStream( f2 ) );
-
- int expectedByte = in1.read();
- while( expectedByte != -1 )
- {
- if( expectedByte != in2.read() )
- {
- return false;
- }
- expectedByte = in1.read();
- }
- if( in2.read() != -1 )
- {
- return false;
- }
- return true;
- }
- finally
- {
- if( in1 != null )
- {
- try
- {
- in1.close();
- }
- catch( IOException e )
- {
- }
- }
- if( in2 != null )
- {
- try
- {
- in2.close();
- }
- catch( IOException e )
- {
- }
- }
- }
- }
-
- /**
* Convienence method to copy a file from a source to a destination
* specifying if token filtering must be used, if source files may
overwrite
* newer destination files and the last modified time of
<code>destFile</code>
* file should be made equal to the last modified time of
<code>sourceFile</code>
* .
- *
- * @param sourceFile Description of Parameter
- * @param destFile Description of Parameter
- * @param filters Description of Parameter
- * @param overwrite Description of Parameter
- * @param preserveLastModified Description of Parameter
- * @throws IOException
*/
- public static void copyFile( File sourceFile,
- File destFile,
- FilterSetCollection filters )
+ public static void copyFile( final File sourceFile,
+ final File destFile,
+ final FilterSetCollection filters )
throws IOException, TaskException
{
if( !destFile.exists() ||
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>