org.eclnt.util.file

## Class FileManager

- java.lang.Object
- - org.eclnt.util.file.FileManager

-     public class FileManager
      extends java.lang.Object

  Helper class for all functions that have to do with File I/O.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileManager()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addAllowedRootDirectoryRead(java.lang.String rootDirectoryName)`
    `static void` | `addAllowedRootDirectoryReadWrite(java.lang.String rootDirectoryName)` You may pass directory names, that restrict the file access.
    `static void` | `appendToFile(java.lang.String fileName, byte[] data, boolean withError)`
    `static void` | `appendUTF8ToFile(java.lang.String fileName, java.lang.String text, boolean withError)`
    `static boolean` | `checkIfFileExists(java.lang.String fileName)`
    `static boolean` | `checkIfFileExists(java.lang.String fileName, boolean internalCall)`
    `static void` | `copyDirectory(java.lang.String fromDirectory, java.lang.String toDirectory, java.lang.String[] ignoreNames, boolean withError)`
    `static void` | `copyDirectory(java.lang.String fromDirectory, java.lang.String toDirectory, java.lang.String[] ignoreNames, boolean withError, IObserver observer)`
    `static void` | `copyFile(java.lang.String fromFile, java.lang.String toFile, boolean withError)`
    `static boolean` | `createDirectory(java.lang.String directory)`
    `static void` | `deleteDirectoryContent(java.lang.String dirName)` Deletes the content of a directory - without removing the directory itself.
    `static void` | `deleteDirectoryContent(java.lang.String dirName, boolean deleteSubDirectories)` Deletes the content of a directory - without removing the directory itself.
    `static void` | `deleteFile(java.lang.String fileName)`
    `static void` | `ensureDirectoryExists(java.lang.String dirName)` Ensure that a certain directory exists.
    `static void` | `ensureDirectoryForFileExists(java.lang.String fileName)` Ensure that the directory for the file exists.
    `static void` | `ensureFileIsWriteable(java.lang.String fileName, boolean withError)`
    `static java.util.List<java.io.File>` | `getDirectoriesOfDirectory(java.lang.String directoryName)`
    `static java.util.List<java.io.File>` | `getFilesOfDirectory(java.lang.String directoryName)`
    `static java.util.List<java.lang.String>` | `getFilesOfDirectoryByPattern(java.lang.String directoryName, java.lang.String extension)`
    `static java.util.List<java.lang.String>` | `getFilesOfDirectoryByPattern(java.lang.String directoryName, java.lang.String pattern, java.lang.String extension)`
    `static java.io.File` | `getTempFileDirectory()`
    `static boolean` | `mkdir(java.lang.String directory)`
    `static byte[]` | `readFile(java.lang.String fileName, boolean withError)`
    `static byte[]` | `readLastBytesOfFile(java.io.File file, int numberOfBytes, boolean withError)`
    `static java.lang.String` | `readTextFile(java.lang.String fileName, java.lang.String encoding, boolean withError)` Encoding can be passes as null value - in this case the VMs default encoding is used.
    `static java.lang.String` | `readUTF8File(java.lang.String fileName, boolean withError)`
    `static void` | `writeFile(java.lang.String fileName, byte[] bytes, boolean withError)`
    `static void` | `writeTextFile(java.lang.String fileName, java.lang.String content, java.lang.String encoding, boolean withError)` Encoding can be passed as null - in this case the VMs default encoding is used.
    `static void` | `writeUTF8File(java.lang.String fileName, java.lang.String content, boolean withError)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FileManager

          public FileManager()

  - ### Method Detail

    - #### addAllowedRootDirectoryReadWrite

          public static void addAllowedRootDirectoryReadWrite(java.lang.String rootDirectoryName)

      You may pass directory names, that restrict the file access. The FileManager will only access files that are below the root directories.

    - #### addAllowedRootDirectoryRead

          public static void addAllowedRootDirectoryRead(java.lang.String rootDirectoryName)

    - #### getFilesOfDirectoryByPattern

          public static java.util.List<java.lang.String> getFilesOfDirectoryByPattern(java.lang.String directoryName,
                                                                                      java.lang.String extension)

    - #### getFilesOfDirectoryByPattern

          public static java.util.List<java.lang.String> getFilesOfDirectoryByPattern(java.lang.String directoryName,
                                                                                      java.lang.String pattern,
                                                                                      java.lang.String extension)

    - #### getFilesOfDirectory

          public static java.util.List<java.io.File> getFilesOfDirectory(java.lang.String directoryName)

    - #### getDirectoriesOfDirectory

          public static java.util.List<java.io.File> getDirectoriesOfDirectory(java.lang.String directoryName)

    - #### ensureDirectoryForFileExists

          public static void ensureDirectoryForFileExists(java.lang.String fileName)

      Ensure that the directory for the file exists. If it does not exist then it will be created.

    - #### ensureDirectoryExists

          public static void ensureDirectoryExists(java.lang.String dirName)

      Ensure that a certain directory exists. If not exists then it will be created.

    - #### checkIfFileExists

          public static boolean checkIfFileExists(java.lang.String fileName)

    - #### checkIfFileExists

          public static boolean checkIfFileExists(java.lang.String fileName,
                                                  boolean internalCall)

    - #### deleteDirectoryContent

          public static void deleteDirectoryContent(java.lang.String dirName)

      Deletes the content of a directory - without removing the directory itself.

    - #### deleteDirectoryContent

          public static void deleteDirectoryContent(java.lang.String dirName,
                                                    boolean deleteSubDirectories)

      Deletes the content of a directory - without removing the directory itself.

    - #### deleteFile

          public static void deleteFile(java.lang.String fileName)

    - #### readUTF8File

          public static java.lang.String readUTF8File(java.lang.String fileName,
                                                      boolean withError)

    - #### readTextFile

          public static java.lang.String readTextFile(java.lang.String fileName,
                                                      java.lang.String encoding,
                                                      boolean withError)

      Encoding can be passes as null value - in this case the VMs default encoding is used.

    - #### readLastBytesOfFile

          public static byte[] readLastBytesOfFile(java.io.File file,
                                                   int numberOfBytes,
                                                   boolean withError)

    - #### readFile

          public static byte[] readFile(java.lang.String fileName,
                                        boolean withError)

    - #### ensureFileIsWriteable

          public static void ensureFileIsWriteable(java.lang.String fileName,
                                                   boolean withError)

    - #### writeUTF8File

          public static void writeUTF8File(java.lang.String fileName,
                                           java.lang.String content,
                                           boolean withError)

    - #### writeTextFile

          public static void writeTextFile(java.lang.String fileName,
                                           java.lang.String content,
                                           java.lang.String encoding,
                                           boolean withError)

      Encoding can be passed as null - in this case the VMs default encoding is used.

    - #### writeFile

          public static void writeFile(java.lang.String fileName,
                                       byte[] bytes,
                                       boolean withError)

    - #### mkdir

          public static boolean mkdir(java.lang.String directory)

    - #### createDirectory

          public static boolean createDirectory(java.lang.String directory)

    - #### copyFile

          public static void copyFile(java.lang.String fromFile,
                                      java.lang.String toFile,
                                      boolean withError)

    - #### copyDirectory

          public static void copyDirectory(java.lang.String fromDirectory,
                                           java.lang.String toDirectory,
                                           java.lang.String[] ignoreNames,
                                           boolean withError)

    - #### copyDirectory

          public static void copyDirectory(java.lang.String fromDirectory,
                                           java.lang.String toDirectory,
                                           java.lang.String[] ignoreNames,
                                           boolean withError,
                                           IObserver observer)

    - #### appendUTF8ToFile

          public static void appendUTF8ToFile(java.lang.String fileName,
                                              java.lang.String text,
                                              boolean withError)

    - #### appendToFile

          public static void appendToFile(java.lang.String fileName,
                                          byte[] data,
                                          boolean withError)

    - #### getTempFileDirectory

          public static java.io.File getTempFileDirectory()

Copyright © CaptainCasa Gmbh. All Rights Reserved.