org.duelengine.duel.utils
Class FileUtil

java.lang.Object
  extended by org.duelengine.duel.utils.FileUtil

public class FileUtil
extends Object


Nested Class Summary
static class FileUtil.HashEncoding
           
 
Field Summary
static String MD5
           
static String SHA1
           
 
Constructor Summary
FileUtil()
           
 
Method Summary
static String calcHash(File file, String algorithm, FileUtil.HashEncoding encoding)
           
static String calcHash(File file, String algorithm, FileUtil.HashEncoding encoding, byte[] buffer)
           
static String calcMD5(File file)
           
static String calcSHA1(File file)
           
static void copy(File source, File target, boolean overwrite)
           
static void copy(File source, File target, boolean overwrite, byte[] buffer)
           
static List<File> findFiles(File root, Set<String> extensions)
           
static List<File> findFiles(File root, String... extensions)
           
static File getCanonicalFile(File file)
           
static File getCanonicalFile(String path)
           
static String getExtension(File file)
           
static String getExtension(String name)
           
static String getRelativePath(File root, File child)
           
static boolean isMD5(String signature)
           
static boolean isSHA1(String signature)
           
static void prepSavePath(File file)
           
static File replaceExtension(File file, String ext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHA1

public static final String SHA1
See Also:
Constant Field Values

MD5

public static final String MD5
See Also:
Constant Field Values
Constructor Detail

FileUtil

public FileUtil()
Method Detail

getCanonicalFile

public static File getCanonicalFile(String path)

getCanonicalFile

public static File getCanonicalFile(File file)

prepSavePath

public static void prepSavePath(File file)

copy

public static void copy(File source,
                        File target,
                        boolean overwrite)
                 throws IOException
Throws:
IOException

copy

public static void copy(File source,
                        File target,
                        boolean overwrite,
                        byte[] buffer)
                 throws IOException
Throws:
IOException

findFiles

public static List<File> findFiles(File root,
                                   String... extensions)

findFiles

public static List<File> findFiles(File root,
                                   Set<String> extensions)

getRelativePath

public static String getRelativePath(File root,
                                     File child)

getExtension

public static String getExtension(File file)

getExtension

public static String getExtension(String name)

replaceExtension

public static File replaceExtension(File file,
                                    String ext)

calcSHA1

public static String calcSHA1(File file)
                       throws FileNotFoundException
Throws:
FileNotFoundException

calcMD5

public static String calcMD5(File file)
                      throws FileNotFoundException
Throws:
FileNotFoundException

calcHash

public static String calcHash(File file,
                              String algorithm,
                              FileUtil.HashEncoding encoding)
                       throws FileNotFoundException
Throws:
FileNotFoundException

calcHash

public static String calcHash(File file,
                              String algorithm,
                              FileUtil.HashEncoding encoding,
                              byte[] buffer)
                       throws FileNotFoundException
Throws:
FileNotFoundException

isSHA1

public static boolean isSHA1(String signature)

isMD5

public static boolean isMD5(String signature)


Copyright © 2012. All Rights Reserved.