Class FileUtilsExtensions


  • public final class FileUtilsExtensions
    extends org.apache.commons.io.FileUtils
    Provides encoding-safe file readers and writers.
    Author:
    aherscu
    • Field Summary

      • Fields inherited from class org.apache.commons.io.FileUtils

        EMPTY_FILE_ARRAY, ONE_EB, ONE_EB_BI, ONE_GB, ONE_GB_BI, ONE_KB, ONE_KB_BI, ONE_MB, ONE_MB_BI, ONE_PB, ONE_PB_BI, ONE_TB, ONE_TB_BI, ONE_YB, ONE_ZB
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void append​(File sourceFile, File targetFile)
      Reads lines from source file and appends them into target file, checking whether the parent directory exists, and creating it if it does not exist.
      static File file​(Class<?> clazz, String name)
      Constructs a File by specified name relative to specified class.
      static Reader fileReader​(File from)
      static Writer fileWriter​(File to)
      static String[] toSuffixes​(String... extensions)
      Converts an array of file extensions to suffixes for use with IOFileFilters.
      • Methods inherited from class org.apache.commons.io.FileUtils

        byteCountToDisplaySize, byteCountToDisplaySize, byteCountToDisplaySize, checksum, checksumCRC32, cleanDirectory, contentEquals, contentEqualsIgnoreEOL, convertFileCollectionToFileArray, copyDirectory, copyDirectory, copyDirectory, copyDirectory, copyDirectory, copyDirectoryToDirectory, copyFile, copyFile, copyFile, copyFile, copyFile, copyFileToDirectory, copyFileToDirectory, copyInputStreamToFile, copyToDirectory, copyToDirectory, copyToFile, copyURLToFile, copyURLToFile, createParentDirectories, current, delete, deleteDirectory, deleteQuietly, directoryContains, forceDelete, forceDeleteOnExit, forceMkdir, forceMkdirParent, getFile, getFile, getTempDirectory, getTempDirectoryPath, getUserDirectory, getUserDirectoryPath, isDirectory, isEmptyDirectory, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileNewer, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isFileOlder, isRegularFile, isSymlink, iterateFiles, iterateFiles, iterateFilesAndDirs, lastModified, lastModifiedFileTime, lastModifiedUnchecked, lineIterator, lineIterator, listFiles, listFiles, listFilesAndDirs, moveDirectory, moveDirectoryToDirectory, moveFile, moveFile, moveFileToDirectory, moveToDirectory, newOutputStream, openInputStream, openOutputStream, openOutputStream, readFileToByteArray, readFileToString, readFileToString, readFileToString, readLines, readLines, readLines, sizeOf, sizeOfAsBigInteger, sizeOfDirectory, sizeOfDirectoryAsBigInteger, streamFiles, toFile, toFiles, touch, toURLs, waitFor, write, write, write, write, write, write, writeByteArrayToFile, writeByteArrayToFile, writeByteArrayToFile, writeByteArrayToFile, writeLines, writeLines, writeLines, writeLines, writeLines, writeLines, writeLines, writeLines, writeStringToFile, writeStringToFile, writeStringToFile, writeStringToFile, writeStringToFile, writeStringToFile
    • Method Detail

      • append

        public static void append​(File sourceFile,
                                  File targetFile)
                           throws IOException
        Reads lines from source file and appends them into target file, checking whether the parent directory exists, and creating it if it does not exist.
        Parameters:
        sourceFile - the source file
        targetFile - the target file
        Throws:
        IOException - in case of an I/O error
      • file

        public static File file​(Class<?> clazz,
                                String name)
        Constructs a File by specified name relative to specified class.
        Parameters:
        clazz - the class from which package to compute
        name - the name
        Returns:
        the file refered by specified name relative to specified class
      • toSuffixes

        public static String[] toSuffixes​(String... extensions)
        Converts an array of file extensions to suffixes for use with IOFileFilters.
        Parameters:
        extensions - an array of extensions. Format: {"java", "xml"}
        Returns:
        an array of suffixes. Format: {".java", ".xml"}