anon.util
Class RecursiveFileTool

java.lang.Object
  extended by anon.util.RecursiveFileTool

public class RecursiveFileTool
extends java.lang.Object


Field Summary
private static int COPY_BUFFER_SIZE
           
private static int EOF
           
private static int INIT_DEPTH
           
private static int MAX_DEPTH_IGNORE
           
 
Constructor Summary
RecursiveFileTool()
           
 
Method Summary
static void copy(java.io.File src, java.io.File dest)
           
private static void copyRecursion(java.io.File src, java.io.File dest, int depth, int maxDepth)
           
static void copyRecursive(java.io.File src, java.io.File dest)
           
static void copyRecursive(java.io.File src, java.io.File dest, int maxDepth)
           
(package private) static void copySingleFile(java.io.File src, java.io.File dest)
           
(package private) static void copySingleFile(java.io.InputStream src, java.io.File dest)
           
static byte[] createMD5Digest(java.io.File a_file)
           
static boolean deleteRecursion(java.io.File src)
           
static boolean equals(java.io.File a_oneFile, byte[] a_md5HashSecond, long a_sizeSecond)
           
static boolean equals(java.io.File a_oneFile, java.io.File a_otherFile, boolean a_doHashComparison)
          Compares two files.
static long getFileSize(java.io.File a_file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_DEPTH

private static final int INIT_DEPTH
See Also:
Constant Field Values

MAX_DEPTH_IGNORE

private static final int MAX_DEPTH_IGNORE
See Also:
Constant Field Values

COPY_BUFFER_SIZE

private static final int COPY_BUFFER_SIZE
See Also:
Constant Field Values

EOF

private static final int EOF
See Also:
Constant Field Values
Constructor Detail

RecursiveFileTool

public RecursiveFileTool()
Method Detail

copy

public static void copy(java.io.File src,
                        java.io.File dest)

copyRecursive

public static void copyRecursive(java.io.File src,
                                 java.io.File dest)

copyRecursive

public static void copyRecursive(java.io.File src,
                                 java.io.File dest,
                                 int maxDepth)

copyRecursion

private static void copyRecursion(java.io.File src,
                                  java.io.File dest,
                                  int depth,
                                  int maxDepth)

copySingleFile

static void copySingleFile(java.io.File src,
                           java.io.File dest)
                    throws java.io.IOException
Throws:
java.io.IOException

deleteRecursion

public static boolean deleteRecursion(java.io.File src)

copySingleFile

static void copySingleFile(java.io.InputStream src,
                           java.io.File dest)
                    throws java.io.IOException
Throws:
java.io.IOException

equals

public static boolean equals(java.io.File a_oneFile,
                             byte[] a_md5HashSecond,
                             long a_sizeSecond)

equals

public static boolean equals(java.io.File a_oneFile,
                             java.io.File a_otherFile,
                             boolean a_doHashComparison)
Compares two files. May optionally do a comparison of MD5 hashes if speed does not matter.

Parameters:
a_oneFile -
a_otherFile -
a_hashComparison - if true, the MD5 hashes of the two files are compared if they seem to be equal after a quick check; false otherwise
Returns:

getFileSize

public static long getFileSize(java.io.File a_file)
                        throws java.lang.SecurityException
Throws:
java.lang.SecurityException

createMD5Digest

public static byte[] createMD5Digest(java.io.File a_file)
                              throws java.io.IOException,
                                     java.lang.SecurityException
Throws:
java.io.IOException
java.lang.SecurityException