org.gcube.informationsystem.glitebridge.util
Class FileUtils

java.lang.Object
  extended by org.gcube.informationsystem.glitebridge.util.FileUtils

public class FileUtils
extends java.lang.Object

Author:
Luca Frosini (ISTI-CNR)

Constructor Summary
FileUtils()
           
 
Method Summary
static void copyFile(java.io.File source, java.io.File target)
          Copy the source file to the the target file
static java.lang.String dateDirectory()
           
static java.lang.String fileToString(java.lang.String absolutePath)
           
static boolean recursiveDeleteDirectory(java.io.File directory)
          Remove Recursively a directory
static void stringToFile(java.lang.String str, java.io.File targetFile)
           
static void writeXmlToFile(org.w3c.dom.Document document, java.io.File file)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

recursiveDeleteDirectory

public static boolean recursiveDeleteDirectory(java.io.File directory)
Remove Recursively a directory

Parameters:
directory - to remove
Returns:
true is the directory is successfully removed

stringToFile

public static void stringToFile(java.lang.String str,
                                java.io.File targetFile)
                         throws java.io.IOException
Parameters:
str - string
targetFile - Target File
Throws:
java.io.IOException - if fails

fileToString

public static java.lang.String fileToString(java.lang.String absolutePath)
                                     throws java.lang.Exception
Parameters:
absolutePath - of the File
Returns:
the string representation of the content of the File
Throws:
java.lang.Exception - if fails

dateDirectory

public static java.lang.String dateDirectory()
Returns:
string representation of the name of a directory in the format DD-MM-YYYY

writeXmlToFile

public static void writeXmlToFile(org.w3c.dom.Document document,
                                  java.io.File file)
                           throws java.lang.Exception
Parameters:
document - xml document
file - output file
Throws:
java.lang.Exception - if fails

copyFile

public static void copyFile(java.io.File source,
                            java.io.File target)
                     throws java.lang.Exception
Copy the source file to the the target file

Parameters:
source - source file
target - target file
Throws:
java.lang.Exception - if fails