Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.autonomy.utilities
Class FileUtils

    java.lang.Object
      |
      +--com.autonomy.utilities.FileUtils

public class FileUtils
extends java.lang.Object

Library of function specifically for use with files

Constructor Summary
`FileUtils()` Constructor.

Method Summary
`static void` | `copyFile(java.io.File in, java.io.File out)` Copies one file to another
`static void` | `copyWithRecurse(java.io.File fileIn, java.io.File fileDest)` Copies files and folders recursively
`static java.lang.String` | `correctSeparators(java.lang.String sFile)` Takes a filename and makes sure the separators used in it are the system specific ones
`static java.lang.String` | `ensureUniqueName(java.lang.String sFullPath)` Takes a full path to a file and adds numbers on to the end of it until the file does not exist.
`static java.lang.String` | `readFileToString(java.lang.String sFileName)` Quick method to read the entire contents of a file into a String
`static void` | `removeWithRecurse(java.io.File fileIn)` Deletes files and folders recursively
`static boolean` | `writeInputStreamToFile(java.io.InputStream inputStream, java.lang.String sFilename, boolean bDeleteIfExists)` Takes the contents of an java.io.InputStream and writes to a file
`static boolean` | `writeStringToFile(java.lang.String sInput, java.lang.String sFilename, boolean bDeleteIfExists)` Takes the contents of an String and writes to a file
`static boolean` | `writeStringToFile(java.lang.String sInput, java.lang.String sFilename, java.lang.String sEncoding, boolean bDeleteIfExists)` Takes the contents of an String and writes to a file

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FileUtils

    public FileUtils()

  Constructor. Takes no action.

Method Detail

### copyFile

    public static void copyFile(java.io.File in,
                                java.io.File out)
                         throws java.lang.Exception

  Copies one file to another

  Parameters:
    `in` - File to copy
    `out` - new File of destination
    `java.lang.Exception`

### removeWithRecurse

    public static void removeWithRecurse(java.io.File fileIn)

  Deletes files and folders recursively

  Parameters:
    `fileIn` - file object for folder or file

### copyWithRecurse

    public static void copyWithRecurse(java.io.File fileIn,
                                       java.io.File fileDest)
                                throws java.lang.Exception

  Copies files and folders recursively

  Parameters:
    `fileIn` - File object to copy from, usually a folder
    `fileDest` - File object for destination folder
    `java.lang.Exception`

### correctSeparators

    public static java.lang.String correctSeparators(java.lang.String sFile)

  Takes a filename and makes sure the separators used in it are the system specific ones

  Parameters:
    `sFile` - Name of file to check
  Returns:
    sFile with corrected file separators

### ensureUniqueName

    public static java.lang.String ensureUniqueName(java.lang.String sFullPath)

  Takes a full path to a file and adds numbers on to the end of it until the file does not exist.

  Parameters:
    `sFullPath` - original full path.
  Returns:
    full path guaranteed to be unique ie no file exists with this name.

### readFileToString

    public static java.lang.String readFileToString(java.lang.String sFileName)

  Quick method to read the entire contents of a file into a String

  Parameters:
    `sFileName` - Full path to file to be read
  Returns:
    Contents of file

### writeInputStreamToFile

    public static boolean writeInputStreamToFile(java.io.InputStream inputStream,
                                                 java.lang.String sFilename,
                                                 boolean bDeleteIfExists)

  Takes the contents of an java.io.InputStream and writes to a file

  Parameters:
    `inputStream` - InputStream to read from
    `sFilename` - Destination file to write to
    `bDeleteIfExists` - If true, will delete the file at the destination path if it exists. If false, will append to destination file

### writeStringToFile

    public static boolean writeStringToFile(java.lang.String sInput,
                                            java.lang.String sFilename,
                                            java.lang.String sEncoding,
                                            boolean bDeleteIfExists)

  Takes the contents of an String and writes to a file

  Parameters:
    `sInput` - String to read from
    `sFilename` - Destination file to write to
    `sEncoding` - Encoding used to write file
    `bDeleteIfExists` - If true, will delete the file at the destination path if it exists. If false, will append to destination file

### writeStringToFile

    public static boolean writeStringToFile(java.lang.String sInput,
                                            java.lang.String sFilename,
                                            boolean bDeleteIfExists)

  Takes the contents of an String and writes to a file

  Parameters:
    `sInput` - String to read from
    `sFilename` - Destination file to write to
    `bDeleteIfExists` - If true, will delete the file at the destination path if it exists. If false, will append to destination file

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD