org.mule.util
Class FileUtils

java.lang.Object
  extended byorg.apache.commons.io.FileUtils
      extended byorg.mule.util.FileUtils

public class FileUtils
extends FileUtils

FileUtils contains useful methods for dealing with files & directories.

See Also:
Serialized Form

Constructor Summary
FileUtils()
           
 
Method Summary
static void copyStreamToFile(InputStream input, File destination)
           
static File createFile(String filename)
           
static boolean deleteTree(File dir)
           
static String getResourcePath(String resourceName, Class callingClass)
           
static String getResourcePath(String resourceName, Class callingClass, String encoding)
           
static File newFile(File parent, String child)
          Workaround for JDK bug 4117557.
static File newFile(String pathName)
          Workaround for JDK bug 4117557.
static File newFile(String parent, String child)
          Workaround for JDK bug 4117557.
static File newFile(URI uri)
          Workaround for JDK bug 4117557.
static File openDirectory(String directory)
           
static String prepareWinFilename(String filename)
           
static File stringToFile(String filename, String data)
          Reads the incoming String into a file at at the given destination.
static File stringToFile(String filename, String data, boolean append)
           
static File stringToFile(String filename, String data, boolean append, boolean newLine)
           
static void unzip(File archive, File directory)
          Unzip the specified archive to the given directory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

copyStreamToFile

public static void copyStreamToFile(InputStream input,
                                    File destination)
                             throws IOException
Throws:
IOException

createFile

public static File createFile(String filename)
                       throws IOException
Throws:
IOException

prepareWinFilename

public static String prepareWinFilename(String filename)

openDirectory

public static File openDirectory(String directory)
                          throws IOException
Throws:
IOException

stringToFile

public static File stringToFile(String filename,
                                String data)
                         throws IOException
Reads the incoming String into a file at at the given destination.

Parameters:
filename - name and path of the file to create
data - the contents of the file
Returns:
the new file.
Throws:
IOException - If the creating or writing to the file stream fails

stringToFile

public static File stringToFile(String filename,
                                String data,
                                boolean append)
                         throws IOException
Throws:
IOException

stringToFile

public static File stringToFile(String filename,
                                String data,
                                boolean append,
                                boolean newLine)
                         throws IOException
Throws:
IOException

getResourcePath

public static String getResourcePath(String resourceName,
                                     Class callingClass)
                              throws IOException
Throws:
IOException

getResourcePath

public static String getResourcePath(String resourceName,
                                     Class callingClass,
                                     String encoding)
                              throws IOException
Throws:
IOException

deleteTree

public static boolean deleteTree(File dir)

unzip

public static void unzip(File archive,
                         File directory)
                  throws IOException
Unzip the specified archive to the given directory

Throws:
IOException

newFile

public static File newFile(String pathName)
Workaround for JDK bug 4117557. More in-context information at MULE-1112

Factory methods correspond to constructors of the java.io.File class. No physical file created in this method.

See Also:
File

newFile

public static File newFile(URI uri)
Workaround for JDK bug 4117557. More in-context information at MULE-1112

Factory methods correspond to constructors of the java.io.File class. No physical file created in this method.

See Also:
File

newFile

public static File newFile(File parent,
                           String child)
Workaround for JDK bug 4117557. More in-context information at MULE-1112

Factory methods correspond to constructors of the java.io.File class. No physical file created in this method.

See Also:
File

newFile

public static File newFile(String parent,
                           String child)
Workaround for JDK bug 4117557. More in-context information at MULE-1112

Factory methods correspond to constructors of the java.io.File class. No physical file created in this method.

See Also:
File


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.