jp.mwsoft.commonsfile

CommonsFile

class CommonsFile extends CommonsFilePlus with CommonsFileUtils with CommonsFilenameUtils

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. CommonsFile
  2. CommonsFilenameUtils
  3. CommonsFileUtils
  4. CommonsFilePlus
  5. AnyRef
  6. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CommonsFile (that: File)

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def absoluteFile : File

    Returns the absolute form of this abstract pathname.

    Returns the absolute form of this abstract pathname.

    Definition Classes
    CommonsFilePlus
  7. def absolutePath : String

    Returns the absolute pathname string of this abstract pathname.

    Returns the absolute pathname string of this abstract pathname.

    Definition Classes
    CommonsFilePlus
  8. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  9. def baseName : String

    Gets the base name, minus the full path and extension, from a full filename.

    Gets the base name, minus the full path and extension, from a full filename.

    This method will handle a file in either Unix or Windows format. The text after the last forward or backslash and before the last dot is returned.

    a/b/c.txt --> c
    a.txt     --> a
    a/b/c     --> c
    a/b/c/    --> ""
    

    The output will be the same irrespective of the machine that the code is running on.

    returns

    the name of the file without the path, or an empty string if none exists

    Definition Classes
    CommonsFilenameUtils
  10. def canonicalFile : File

    Returns the canonical form of this abstract pathname.

    Returns the canonical form of this abstract pathname.

    Definition Classes
    CommonsFilePlus
  11. def canonicalPath : String

    Returns the canonical pathname string of this abstract pathname.

    Returns the canonical pathname string of this abstract pathname.

    Definition Classes
    CommonsFilePlus
  12. def checksum (checksum: Checksum): Checksum

    Computes the checksum of a file using the specified checksum object.

    Computes the checksum of a file using the specified checksum object. Multiple files may be checked using one Checksum instance if desired simply by reusing the same checksum object. For example:

      long csum = FileUtils.checksum(file, new CRC32()).getValue();
    

    checksum

    the checksum object to be used, must not be null

    returns

    the checksum specified, updated with the content of the file

    Definition Classes
    CommonsFileUtils
  13. def checksumCRC32 : Long

    Computes the checksum of a file using the CRC32 checksum routine.

    Computes the checksum of a file using the CRC32 checksum routine. The value of the checksum is returned.

    Definition Classes
    CommonsFileUtils
  14. def cleanDir (): File

    Cleans a directory without deleting it.

    Cleans a directory without deleting it.

    returns

    this file

    Definition Classes
    CommonsFileUtils
  15. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  16. def concatPath (fullFilenameToAdd: File): String

    Concatenates a filename to a base path using normal command line style rules.

    Concatenates a filename to a base path using normal command line style rules.

    The effect is equivalent to resultant directory after changing directory to the first argument, followed by changing directory to the second argument.

    The first argument is the base path, the second is the path to concatenate. The returned path is always normalized via #normalize(String), thus .. is handled.

    If pathToAdd is absolute (has an absolute prefix), then it will be normalized and returned. Otherwise, the paths will be joined, normalized and returned.

    The output will be the same on both Unix and Windows except for the separator character.

    /foo/ + bar          -->   /foo/bar
    /foo + bar           -->   /foo/bar
    /foo + /bar          -->   /bar
    /foo + C:/bar        -->   C:/bar
    /foo + C:bar         -->   C:bar (*)
    /foo/a/ + ../bar     -->   foo/bar
    /foo/ + ../../bar    -->   null
    /foo/ + /bar         -->   /bar
    /foo/.. + /bar       -->   /bar
    /foo + bar/c.txt     -->   /foo/bar/c.txt
    /foo/c.txt + bar     -->   /foo/c.txt/bar (!)
    
    (*) Note that the Windows relative drive prefix is unreliable when used with this method. (!) Note that the first parameter must be a path. If it ends with a name, then the name will be built into the concatenated path. If this might be a problem, use #getFullPath(String) on the base path argument.

    fullFilenameToAdd

    the filename (or path) to attach to the base

    returns

    the concatenated path, or null if invalid

    Definition Classes
    CommonsFilenameUtils
  17. def concatPath (fullFilenameToAdd: String): String

    Concatenates a filename to a base path using normal command line style rules.

    Concatenates a filename to a base path using normal command line style rules.

    The effect is equivalent to resultant directory after changing directory to the first argument, followed by changing directory to the second argument.

    The first argument is the base path, the second is the path to concatenate. The returned path is always normalized via #normalize(String), thus .. is handled.

    If pathToAdd is absolute (has an absolute prefix), then it will be normalized and returned. Otherwise, the paths will be joined, normalized and returned.

    The output will be the same on both Unix and Windows except for the separator character.

    /foo/ + bar          -->   /foo/bar
    /foo + bar           -->   /foo/bar
    /foo + /bar          -->   /bar
    /foo + C:/bar        -->   C:/bar
    /foo + C:bar         -->   C:bar (*)
    /foo/a/ + ../bar     -->   foo/bar
    /foo/ + ../../bar    -->   null
    /foo/ + /bar         -->   /bar
    /foo/.. + /bar       -->   /bar
    /foo + bar/c.txt     -->   /foo/bar/c.txt
    /foo/c.txt + bar     -->   /foo/c.txt/bar (!)
    
    (*) Note that the Windows relative drive prefix is unreliable when used with this method. (!) Note that the first parameter must be a path. If it ends with a name, then the name will be built into the concatenated path. If this might be a problem, use #getFullPath(String) on the base path argument.

    fullFilenameToAdd

    the filename (or path) to attach to the base

    returns

    the concatenated path, or null if invalid

    Definition Classes
    CommonsFilenameUtils
  18. def concatPathFile (fullFilenameToAdd: String): File

    Concatenates a filename to a base path using normal command line style rules.

    Concatenates a filename to a base path using normal command line style rules.

    The effect is equivalent to resultant directory after changing directory to the first argument, followed by changing directory to the second argument.

    The first argument is the base path, the second is the path to concatenate. The returned path is always normalized via #normalize(String), thus .. is handled.

    If pathToAdd is absolute (has an absolute prefix), then it will be normalized and returned. Otherwise, the paths will be joined, normalized and returned.

    The output will be the same on both Unix and Windows except for the separator character.

    /foo/ + bar          -->   /foo/bar
    /foo + bar           -->   /foo/bar
    /foo + /bar          -->   /bar
    /foo + C:/bar        -->   C:/bar
    /foo + C:bar         -->   C:bar (*)
    /foo/a/ + ../bar     -->   foo/bar
    /foo/ + ../../bar    -->   null
    /foo/ + /bar         -->   /bar
    /foo/.. + /bar       -->   /bar
    /foo + bar/c.txt     -->   /foo/bar/c.txt
    /foo/c.txt + bar     -->   /foo/c.txt/bar (!)
    
    (*) Note that the Windows relative drive prefix is unreliable when used with this method. (!) Note that the first parameter must be a path. If it ends with a name, then the name will be built into the concatenated path. If this might be a problem, use #getFullPath(String) on the base path argument.

    fullFilenameToAdd

    the filename (or path) to attach to the base

    returns

    the concatenated path, or null if invalid

    Definition Classes
    CommonsFilenameUtils
  19. def concatPathFile (fullFilenameToAdd: File): File

    Concatenates a filename to a base path using normal command line style rules.

    Concatenates a filename to a base path using normal command line style rules.

    The effect is equivalent to resultant directory after changing directory to the first argument, followed by changing directory to the second argument.

    The first argument is the base path, the second is the path to concatenate. The returned path is always normalized via #normalize(String), thus .. is handled.

    If pathToAdd is absolute (has an absolute prefix), then it will be normalized and returned. Otherwise, the paths will be joined, normalized and returned.

    The output will be the same on both Unix and Windows except for the separator character.

    /foo/ + bar          -->   /foo/bar
    /foo + bar           -->   /foo/bar
    /foo + /bar          -->   /bar
    /foo + C:/bar        -->   C:/bar
    /foo + C:bar         -->   C:bar (*)
    /foo/a/ + ../bar     -->   foo/bar
    /foo/ + ../../bar    -->   null
    /foo/ + /bar         -->   /bar
    /foo/.. + /bar       -->   /bar
    /foo + bar/c.txt     -->   /foo/bar/c.txt
    /foo/c.txt + bar     -->   /foo/c.txt/bar (!)
    
    (*) Note that the Windows relative drive prefix is unreliable when used with this method. (!) Note that the first parameter must be a path. If it ends with a name, then the name will be built into the concatenated path. If this might be a problem, use #getFullPath(String) on the base path argument.

    fullFilenameToAdd

    the filename (or path) to attach to the base

    returns

    the concatenated path, or null if invalid

    Definition Classes
    CommonsFilenameUtils
  20. def contentEquals (file: File): Boolean

    Compares the contents of two files to determine if they are equal or not.

    Compares the contents of two files to determine if they are equal or not.

    This method checks to see if the two files are different lengths or if they point to the same file, before resorting to byte-by-byte comparison of the contents.

    Code origin: Avalon

    file

    the second file

    returns

    true if the content of the files are equal or they both don't exist, false otherwise

    Definition Classes
    CommonsFileUtils
  21. def copyDir (destDir: String, filter: FileFilter, preserveFileDate: Boolean): File

    Copies a filtered directory to a new location.

    Copies a filtered directory to a new location.

    This method copies the contents of the specified source directory to within the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: Setting preserveFileDate to true tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    destDir

    the new directory, must not be null

    filter

    the filter to apply, null means copy all directories and files

    preserveFileDate

    true if the file date of the copy should be the same as the original

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  22. def copyDir (destDir: String, filter: FileFilter): File

    Copies a filtered directory to a new location.

    Copies a filtered directory to a new location.

    This method copies the contents of the specified source directory to within the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: Setting preserveFileDate to true tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    destDir

    the new directory, must not be null

    filter

    the filter to apply, null means copy all directories and files

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  23. def copyDir (destDir: File, filter: FileFilter, preserveFileDate: Boolean): File

    Copies a filtered directory to a new location.

    Copies a filtered directory to a new location.

    This method copies the contents of the specified source directory to within the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: Setting preserveFileDate to true tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    Example: Copy directories only

     // only copy the directory structure
     copyDir(destDir, (file: File => file.isDirectory), false);
    

    destDir

    the new directory, must not be null

    filter

    the filter to apply, null means copy all directories and files

    preserveFileDate

    true if the file date of the copy should be the same as the original

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  24. def copyDir (destDir: File, filter: FileFilter): File

    Copies a filtered directory to a new location.

    Copies a filtered directory to a new location.

    This method copies the contents of the specified source directory to within the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: Setting preserveFileDate to true tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    Example: Copy directories only

     // only copy the directory structure
     copyDir(destDir, (file: File => file.isDirectory), false);
    

    destDir

    the new directory, must not be null

    filter

    the filter to apply, null means copy all directories and files

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  25. def copyDir (destDir: String): File

    Copies a whole directory to a new location.

    Copies a whole directory to a new location.

    This method copies the contents of the specified source directory to within the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: Setting preserveFileDate to true tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    destDir

    the new directory, must not be null should be the same as the original

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  26. def copyDir (destDir: String, preserveFileDate: Boolean): File

    Copies a whole directory to a new location.

    Copies a whole directory to a new location.

    This method copies the contents of the specified source directory to within the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: Setting preserveFileDate to true tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    destDir

    the new directory, must not be null

    preserveFileDate

    true if the file date of the copy should be the same as the original

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  27. def copyDir (destDir: File): File

    Copies a whole directory to a new location.

    Copies a whole directory to a new location.

    This method copies the contents of the specified source directory to within the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: Setting preserveFileDate to true tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    destDir

    the new directory, must not be null

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  28. def copyDir (destDir: File, preserveFileDate: Boolean): File

    Copies a whole directory to a new location.

    Copies a whole directory to a new location.

    This method copies the contents of the specified source directory to within the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: Setting preserveFileDate to true tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    destDir

    the new directory, must not be null

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  29. def copyDirToDir (destDir: String): File

    Copies a directory to within another directory preserving the file dates.

    Copies a directory to within another directory preserving the file dates.

    This method copies the source directory and all its contents to a directory of the same name in the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: This method tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    destDir

    the directory to place the copy in, must not be null

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  30. def copyDirToDir (destDir: File): File

    Copies a directory to within another directory preserving the file dates.

    Copies a directory to within another directory preserving the file dates.

    This method copies the source directory and all its contents to a directory of the same name in the specified destination directory.

    The destination directory is created if it does not exist. If the destination directory did exist, then this method merges the source with the destination, with the source taking precedence.

    Note: This method tries to preserve the files' last modified date/times using File#setLastModified(long), however it is not guaranteed that those operations will succeed. If the modification operation fails, no indication is provided.

    destDir

    the directory to place the copy in, must not be null

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  31. def copyFile (destFile: String): File

    Copies a file to a new location.

    Copies a file to a new location.

    This method copies the contents of the specified source file to the specified destination file. The directory holding the destination file is created if it does not exist. If the destination file exists, then this method will overwrite it.

    destFile

    the new file, must not be null

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  32. def copyFile (destFile: String, preserveFileDate: Boolean): File

    Copies a file to a new location.

    Copies a file to a new location.

    This method copies the contents of the specified source file to the specified destination file. The directory holding the destination file is created if it does not exist. If the destination file exists, then this method will overwrite it.

    Note: Setting preserveFileDate to true tries to preserve the file's last modified date/times using File#setLastModified(long), however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

    destFile

    the new file, must not be null

    preserveFileDate

    true if the file date of the copy should be the same as the original

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  33. def copyFile (destFile: File): File

    Copies a file to a new location.

    Copies a file to a new location.

    This method copies the contents of the specified source file to the specified destination file. The directory holding the destination file is created if it does not exist. If the destination file exists, then this method will overwrite it.

    destFile

    the new file, must not be null

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  34. def copyFile (destFile: File, preserveFileDate: Boolean): File

    Copies a file to a new location.

    Copies a file to a new location.

    This method copies the contents of the specified source file to the specified destination file. The directory holding the destination file is created if it does not exist. If the destination file exists, then this method will overwrite it.

    Note: Setting preserveFileDate to true tries to preserve the file's last modified date/times using File#setLastModified(long), however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

    destFile

    the new file, must not be null

    preserveFileDate

    true if the file date of the copy should be the same as the original

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  35. def copyFileToDir (destDir: String): File

    Copies a file to a directory optionally preserving the file date.

    Copies a file to a directory optionally preserving the file date.

    This method copies the contents of the specified source file to a file of the same name in the specified destination directory. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it.

    Note: Setting preserveFileDate to true tries to preserve the file's last modified date/times using File#setLastModified(long), however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

    destDir

    the directory to place the copy in, must not be null

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  36. def copyFileToDir (destDir: String, preserveFileDate: Boolean): File

    Copies a file to a directory optionally preserving the file date.

    Copies a file to a directory optionally preserving the file date.

    This method copies the contents of the specified source file to a file of the same name in the specified destination directory. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it.

    Note: Setting preserveFileDate to true tries to preserve the file's last modified date/times using File#setLastModified(long), however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

    destDir

    the directory to place the copy in, must not be null

    preserveFileDate

    true if the file date of the copy should be the same as the original

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  37. def copyFileToDir (destDir: File): File

    Copies a file to a directory optionally preserving the file date.

    Copies a file to a directory optionally preserving the file date.

    This method copies the contents of the specified source file to a file of the same name in the specified destination directory. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it.

    Note: Setting preserveFileDate to true tries to preserve the file's last modified date/times using File#setLastModified(long), however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

    destDir

    the directory to place the copy in, must not be null

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  38. def copyFileToDir (destDir: File, preserveFileDate: Boolean): File

    Copies a file to a directory optionally preserving the file date.

    Copies a file to a directory optionally preserving the file date.

    This method copies the contents of the specified source file to a file of the same name in the specified destination directory. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it.

    Note: Setting preserveFileDate to true tries to preserve the file's last modified date/times using File#setLastModified(long), however it is not guaranteed that the operation will succeed. If the modification operation fails, no indication is provided.

    destDir

    the directory to place the copy in, must not be null

    preserveFileDate

    true if the file date of the copy should be the same as the original

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  39. def copyFromInputStream (source: InputStream): File

    Copies bytes from an InputStream source to a file destination.

    Copies bytes from an InputStream source to a file destination. The directories up to destination will be created if they don't already exist. destination will be overwritten if it already exists.

    source

    the InputStream to copy bytes from, must not be null

    returns

    this file

    Definition Classes
    CommonsFileUtils
  40. def copyFromURL (url: String, connectionTimeouut: Int, readTimeout: Int): File

    Copies bytes from the URL source to a file destination.

    Copies bytes from the URL source to a file destination. The directories up to destination will be created if they don't already exist. destination will be overwritten if it already exists.

    url

    the URL to copy bytes from, must not be null

    readTimeout

    the number of milliseconds until this method will timeout if no data could be read from the source

    returns

    this file

    Definition Classes
    CommonsFileUtils
  41. def copyFromURL (url: URL, connectionTimeouut: Int, readTimeout: Int): File

    Copies bytes from the URL source to a file destination.

    Copies bytes from the URL source to a file destination. The directories up to destination will be created if they don't already exist. destination will be overwritten if it already exists.

    url

    the URL to copy bytes from, must not be null

    readTimeout

    the number of milliseconds until this method will timeout if no data could be read from the source

    returns

    this file

    Definition Classes
    CommonsFileUtils
  42. def copyFromURL (url: String): File

    Copies bytes from the URL source to a file destination.

    Copies bytes from the URL source to a file destination. The directories up to destination will be created if they don't already exist. destination will be overwritten if it already exists.

    Warning: this method does not set a connection or read timeout and thus might block forever. Use #copyURLToFile(URL, File, int, int) with reasonable timeouts to prevent this.

    url

    the URL to copy bytes from, must not be null

    returns

    this file

    Definition Classes
    CommonsFileUtils
  43. def copyFromURL (url: URL): File

    Copies bytes from the URL source to a file destination.

    Copies bytes from the URL source to a file destination. The directories up to destination will be created if they don't already exist. destination will be overwritten if it already exists.

    Warning: this method does not set a connection or read timeout and thus might block forever. Use #copyURLToFile(URL, File, int, int) with reasonable timeouts to prevent this.

    url

    the URL to copy bytes from, must not be null

    returns

    this file

    Definition Classes
    CommonsFileUtils
  44. def deleteDir (): Unit

    Deletes a directory recursively.

    Deletes a directory recursively.

    Definition Classes
    CommonsFileUtils
  45. def deleteQuietly (): Boolean

    Deletes a file, never throwing an exception.

    Deletes a file, never throwing an exception. If file is a directory, delete it and all sub-directories.

    The difference between File.delete() and this method are:

    • A directory to be deleted does not have to be empty.
    • No exceptions are thrown when a file or directory cannot be deleted.
    returns

    true if the file or directory was deleted, otherwise false

    Definition Classes
    CommonsFileUtils
  46. def dirPath : String

    Gets the full path from a full filename, which is the prefix + path.

    Gets the full path from a full filename, which is the prefix + path.

    This method will handle a file in either Unix or Windows format. The method is entirely text based, and returns the text before and including the last forward or backslash.

    C:\a\b\c.txt --> C:\a\b\
    ~/a/b/c.txt  --> ~/a/b/
    a.txt        --> ""
    a/b/c        --> a/b/
    a/b/c/       --> a/b/c/
    C:           --> C:
    C:\          --> C:\
    ~            --> ~/
    ~/           --> ~/
    ~user        --> ~user/
    ~user/       --> ~user/
    

    The output will be the same irrespective of the machine that the code is running on.

    returns

    the path of the file, an empty string if none exists, null if invalid

    Definition Classes
    CommonsFilenameUtils
  47. def displaySize : String

    Returns a human-readable version of the file size, where the input represents a specific number of bytes.

    Returns a human-readable version of the file size, where the input represents a specific number of bytes.

    If the size is over 1GB, the size is returned as the number of whole GB, i.e. the size is rounded down to the nearest GB boundary.

    Similarly for the 1MB and 1KB boundaries.

    returns

    a human-readable display value (includes units - GB, MB, KB or bytes)

    Definition Classes
    CommonsFileUtils
  48. def eachLine [B] (f: (String) ⇒ B, encoding: String): Unit

    Applies a function f to all line.

    Applies a function f to all line.

    f

    function

    encoding

    the encoding to use, null means platform default

    Definition Classes
    CommonsFilePlus
  49. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  50. def equalPath (file: File, normalized: Boolean, caseSensitivity: IOCase = IOCase.SYSTEM): Boolean

    Checks whether two filenames are equal, optionally normalizing and providing control over the case-sensitivity.

    Checks whether two filenames are equal, optionally normalizing and providing control over the case-sensitivity.

    file

    the second filename to query, may be null

    normalized

    whether to normalize the filenames

    caseSensitivity

    what case sensitivity rule to use, null means case-sensitive

    returns

    true if the filenames are equal, null equals null

    Definition Classes
    CommonsFilenameUtils
  51. def equalPath (file: String): Boolean

    Checks whether two filenames are equal after both have been normalized and using the case rules of the system.

    Checks whether two filenames are equal after both have been normalized and using the case rules of the system.

    Both filenames are first passed to #normalize(String). The check is then performed case-sensitive on Unix and case-insensitive on Windows.

    file

    the second filename to query, may be null

    returns

    true if the filenames are equal, null equals null

    Definition Classes
    CommonsFilenameUtils
  52. def equalPath (file: File): Boolean

    Checks whether two filenames are equal after both have been normalized and using the case rules of the system.

    Checks whether two filenames are equal after both have been normalized and using the case rules of the system.

    Both filenames are first passed to #normalize(String). The check is then performed case-sensitive on Unix and case-insensitive on Windows.

    file

    the second filename to query, may be null

    returns

    true if the filenames are equal, null equals null

    Definition Classes
    CommonsFilenameUtils
  53. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  54. def extension : String

    Gets the extension of a filename.

    Gets the extension of a filename.

    This method returns the textual part of the filename after the last dot. There must be no directory separator after the dot.

    foo.txt      --> "txt"
    a/b/c.jpg    --> "jpg"
    a/b.txt/c    --> ""
    a/b/c        --> ""
    

    The output will be the same irrespective of the machine that the code is running on.

    returns

    the extension of the file or an empty string if none exists or null if the filename is null.

    Definition Classes
    CommonsFilenameUtils
  55. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  56. def forceDelete (): Unit

    Deletes a file.

    Deletes a file. If file is a directory, delete it and all sub-directories.

    The difference between File.delete() and this method are:

    • A directory to be deleted does not have to be empty.
    • You get exceptions when a file or directory cannot be deleted. (java.io.File methods returns a boolean)
    Definition Classes
    CommonsFileUtils
  57. def forceDeleteOnExit (): Unit

    Schedules a file to be deleted when JVM exits.

    Schedules a file to be deleted when JVM exits. If file is directory delete it and all sub-directories.

    Definition Classes
    CommonsFileUtils
  58. def forceMkdir (): File

    Makes a directory, including any necessary but nonexistent parent directories.

    Makes a directory, including any necessary but nonexistent parent directories. If a file already exists with specified name but it is not a directory then an IOException is thrown. If the directory cannot be created (or does not already exist) then an IOException is thrown.

    returns

    this file

    Definition Classes
    CommonsFileUtils
  59. def freeSpace : Long

    Returns the number of unallocated bytes in the partition named by this abstract path name.

    Returns the number of unallocated bytes in the partition named by this abstract path name.

    Definition Classes
    CommonsFilePlus
  60. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef
  61. def getPrefix : String

    Gets the prefix from a full filename, such as C:/ or ~/.

    Gets the prefix from a full filename, such as C:/ or ~/.

    This method will handle a file in either Unix or Windows format. The prefix includes the first slash in the full filename where applicable.

    Windows:
    a\b\c.txt           --> ""          --> relative
    \a\b\c.txt          --> "\"         --> current drive absolute
    C:a\b\c.txt         --> "C:"        --> drive relative
    C:\a\b\c.txt        --> "C:\"       --> absolute
    \\server\a\b\c.txt  --> "\\server\" --> UNC
    
    Unix:
    a/b/c.txt           --> ""          --> relative
    /a/b/c.txt          --> "/"         --> absolute
    ~/a/b/c.txt         --> "~/"        --> current user
    ~                   --> "~/"        --> current user (slash added)
    ~user/a/b/c.txt     --> "~user/"    --> named user
    ~user               --> "~user/"    --> named user (slash added)
    

    The output will be the same irrespective of the machine that the code is running on. ie. both Unix and Windows prefixes are matched regardless.

    returns

    the prefix of the file, null if invalid

    Definition Classes
    CommonsFilenameUtils
  62. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  63. def indexOfExtension : Int

    Returns the index of the last extension separator character, which is a dot.

    Returns the index of the last extension separator character, which is a dot.

    This method also checks that there is no directory separator after the last dot. To do this it uses #indexOfLastSeparator(String) which will handle a file in either Unix or Windows format.

    The output will be the same irrespective of the machine that the code is running on.

    returns

    the index of the last separator character, or -1 if there is no such character

    Definition Classes
    CommonsFilenameUtils
  64. def indexOfLastSeparator : Int

    Returns the index of the last directory separator character.

    Returns the index of the last directory separator character.

    This method will handle a file in either Unix or Windows format. The position of the last forward or backslash is returned.

    The output will be the same irrespective of the machine that the code is running on.

    returns

    the index of the last separator character, or -1 if there is no such character

    Definition Classes
    CommonsFilenameUtils
  65. def isExtension (extensions: Seq[String]): Boolean

    Checks whether the extension of the filename is one of those specified.

    Checks whether the extension of the filename is one of those specified.

    This method obtains the extension as the textual part of the filename after the last dot. There must be no directory separator after the dot. The extension check is case-sensitive on all platforms.

    extensions

    the extensions to check for, null checks for no extension

    returns

    true if the filename is one of the extensions

    Definition Classes
    CommonsFilenameUtils
  66. def isExtension (extension: String): Boolean

    Checks whether the extension of the filename is that specified.

    Checks whether the extension of the filename is that specified.

    This method obtains the extension as the textual part of the filename after the last dot. There must be no directory separator after the dot. The extension check is case-sensitive on all platforms.

    extension

    the extension to check for, null or empty checks for no extension

    returns

    true if the filename has the specified extension

    Definition Classes
    CommonsFilenameUtils
  67. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  68. def isNewer (timeMillis: Long): Boolean

    Tests if the specified File is newer than the specified time reference.

    Tests if the specified File is newer than the specified time reference.

    timeMillis

    the time reference measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)

    returns

    true if the File exists and has been modified after the given time reference.

    Definition Classes
    CommonsFileUtils
  69. def isNewer (date: Date): Boolean

    Tests if the specified File is newer than the specified Date.

    Tests if the specified File is newer than the specified Date.

    date

    the date reference, must not be null

    returns

    true if the File exists and has been modified after the given Date.

    Definition Classes
    CommonsFileUtils
  70. def isNewer (file: File): Boolean

    Tests if the specified File is newer than the reference File.

    Tests if the specified File is newer than the reference File.

    returns

    true if the File exists and has been modified more recently than the reference File

    Definition Classes
    CommonsFileUtils
  71. def isOlder (timeMillis: Long): Boolean

    Tests if the specified File is older than the specified time reference.

    Tests if the specified File is older than the specified time reference.

    timeMillis

    the time reference measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)

    returns

    true if the File exists and has been modified before the given time reference.

    Definition Classes
    CommonsFileUtils
  72. def isOlder (date: Date): Boolean

    Tests if the specified File is older than the specified Date.

    Tests if the specified File is older than the specified Date.

    date

    the date reference, must not be null

    returns

    true if the File exists and has been modified before the given Date.

    Definition Classes
    CommonsFileUtils
  73. def isOlder (reference: File): Boolean

    Tests if the specified File is older than the reference File.

    Tests if the specified File is older than the reference File.

    reference

    the File of which the modification date is used, must not be null

    returns

    true if the File exists and has been modified before the reference File

    Definition Classes
    CommonsFileUtils
  74. def isSymlink : Boolean

    Determines whether the specified file is a Symbolic Link rather than an actual file.

    Determines whether the specified file is a Symbolic Link rather than an actual file.

    Will not return true if there is a Symbolic Link anywhere in the path, only if the specific file is.

    returns

    true if the file is a Symbolic Link

    Definition Classes
    CommonsFileUtils
  75. def lineIterator (encoding: String = null): LineIterator

    Returns an Iterator for the lines in a File.

    Returns an Iterator for the lines in a File.

    This method opens an InputStream for the file. When you have finished with the iterator you should close the stream to free internal resources. This can be done by calling the LineIterator#close() or LineIterator#closeQuietly(LineIterator) method.

    The recommended usage pattern is:

    LineIterator it = file.lineIterator("UTF-8");
    try {
      while (it.hasNext()) {
        String line = it.nextLine();
        /// do something with line
      }
    } finally {
      LineIterator.closeQuietly(iterator);
    }
    

    If an exception occurs during the creation of the iterator, the underlying stream is closed.

    encoding

    the encoding to use, null means platform default

    returns

    an Iterator of the lines in the file, never null

    Definition Classes
    CommonsFileUtils
  76. def listFiles (extensions: Array[String]): Array[File]

    Finds files within a given directory which match an array of extensions.

    Finds files within a given directory which match an array of extensions.

    extensions

    an array of extensions, ex. {"java","xml"}. If this parameter is null, all files are returned.

    Definition Classes
    CommonsFileUtils
  77. def listFilesRecursive (extensions: Array[String]): Array[File]

    Finds files within a given directory and its subdirectories which match an array of extensions.

    Finds files within a given directory and its subdirectories which match an array of extensions.

    extensions

    an array of extensions, ex. {"java","xml"}. If this

    Definition Classes
    CommonsFileUtils
  78. def listFilesRecursive : Array[File]

    Finds files within a given directory and its subdirectories.

    Finds files within a given directory and its subdirectories.

    Definition Classes
    CommonsFileUtils
  79. def modeDirToDir (destPath: String): File

    Moves a directory to another directory.

    Moves a directory to another directory. create the destination directory

    destPath

    the destination file

    returns

    the destination directory

    Definition Classes
    CommonsFileUtils
  80. def modeDirToDir (destDir: File): File

    Moves a directory to another directory.

    Moves a directory to another directory. create the destination directory

    returns

    the destination directory

    Definition Classes
    CommonsFileUtils
  81. def moveDir (destPath: String): File

    Moves a directory.

    Moves a directory.

    When the destination directory is on another file system, do a "copy and delete".

    returns

    the destination directory

    Definition Classes
    CommonsFileUtils
  82. def moveDir (destDir: File): File

    Moves a directory.

    Moves a directory.

    When the destination directory is on another file system, do a "copy and delete".

    destDir

    the destination directory

    returns

    the destination directory

    Definition Classes
    CommonsFileUtils
  83. def moveDirToDir (destPath: String, createDestDir: Boolean): File

    Moves a directory to another directory.

    Moves a directory to another directory.

    createDestDir

    If true create the destination directory, otherwise if false throw an IOException

    returns

    the destination directory

    Definition Classes
    CommonsFileUtils
  84. def moveDirToDir (destDir: File, createDestDir: Boolean): File

    Moves a directory to another directory.

    Moves a directory to another directory.

    destDir

    the destination file

    createDestDir

    If true create the destination directory, otherwise if false throw an IOException

    returns

    the destination directory

    Definition Classes
    CommonsFileUtils
  85. def moveFile (destPath: String): File

    Moves a file.

    Moves a file.

    When the destination file is on another file system, do a "copy and delete".

    destPath

    the destination file

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  86. def moveFile (destFile: File): File

    Moves a file.

    Moves a file.

    When the destination file is on another file system, do a "copy and delete".

    destFile

    the destination file

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  87. def moveFileToDir (destPath: String): File

    Moves a file to a directory.

    Moves a file to a directory. create the destination directory.

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  88. def moveFileToDir (destDir: File): File

    Moves a file to a directory.

    Moves a file to a directory. create the destination directory.

    destDir

    the destination file

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  89. def moveFileToDir (destPath: String, createDestDir: Boolean): File

    Moves a file to a directory.

    Moves a file to a directory.

    createDestDir

    If true create the destination directory, otherwise if false throw an IOException

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  90. def moveFileToDir (destDir: File, createDestDir: Boolean): File

    Moves a file to a directory.

    Moves a file to a directory.

    destDir

    the destination file

    createDestDir

    If true create the destination directory, otherwise if false throw an IOException

    returns

    the destination file

    Definition Classes
    CommonsFileUtils
  91. def moveToDir (destPath: String): File

    Moves a file or directory to the destination directory.

    Moves a file or directory to the destination directory. create the destination directory,

    When the destination is on another file system, do a "copy and delete".

    destPath

    the destination directory

    returns

    the destination file or directory

    Definition Classes
    CommonsFileUtils
  92. def moveToDir (destDir: File): File

    Moves a file or directory to the destination directory.

    Moves a file or directory to the destination directory. create the destination directory,

    When the destination is on another file system, do a "copy and delete".

    destDir

    the destination directory

    returns

    the destination file or directory

    Definition Classes
    CommonsFileUtils
  93. def moveToDir (destPath: String, createDestDir: Boolean): File

    Moves a file or directory to the destination directory.

    Moves a file or directory to the destination directory.

    When the destination is on another file system, do a "copy and delete".

    destPath

    the destination directory

    createDestDir

    If true create the destination directory, otherwise if false throw an IOException

    returns

    the destination file or directory

    Definition Classes
    CommonsFileUtils
  94. def moveToDir (destDir: File, createDestDir: Boolean): File

    Moves a file or directory to the destination directory.

    Moves a file or directory to the destination directory.

    When the destination is on another file system, do a "copy and delete".

    destDir

    the destination directory

    createDestDir

    If true create the destination directory, otherwise if false throw an IOException

    returns

    the destination file or directory

    Definition Classes
    CommonsFileUtils
  95. def name : String

    Returns the name of the file or directory denoted by this abstract pathname.

    Returns the name of the file or directory denoted by this abstract pathname.

    Definition Classes
    CommonsFilePlus
  96. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  97. def normalizePath : String

    Normalizes a path, removing double and single dot path steps.

    Normalizes a path, removing double and single dot path steps.

    This method normalizes a path to a standard format. The input may contain separators in either Unix or Windows format. The output will contain separators in the format specified.

    A trailing slash will be retained. A double slash will be merged to a single slash (but UNC names are handled). A single dot path segment will be removed. A double dot will cause that path segment and the one before to be removed. If the double dot has no parent path segment to work with, null is returned.

    The output will be the same on both Unix and Windows except for the separator character.

    /foo//               -->   /foo/
    /foo/./              -->   /foo/
    /foo/../bar          -->   /bar
    /foo/../bar/         -->   /bar/
    /foo/../bar/../baz   -->   /baz
    //foo//./bar         -->   /foo/bar
    /../                 -->   null
    ../foo               -->   null
    foo/bar/..           -->   foo/
    foo/../../bar        -->   null
    foo/../bar           -->   bar
    //server/foo/../bar  -->   //server/bar
    //server/../bar      -->   null
    C:\foo\..\bar        -->   C:\bar
    C:\..\bar            -->   null
    ~/foo/../bar/        -->   ~/bar/
    ~/../bar             -->   null
    
    The output will be the same on both Unix and Windows including the separator character.

    returns

    the normalized filename, or null if invalid

    Definition Classes
    CommonsFilenameUtils
  98. def normalizePath (unixSeparator: Boolean): String

    Normalizes a path, removing double and single dot path steps.

    Normalizes a path, removing double and single dot path steps.

    This method normalizes a path to a standard format. The input may contain separators in either Unix or Windows format. The output will contain separators in the format specified.

    A trailing slash will be retained. A double slash will be merged to a single slash (but UNC names are handled). A single dot path segment will be removed. A double dot will cause that path segment and the one before to be removed. If the double dot has no parent path segment to work with, null is returned.

    The output will be the same on both Unix and Windows except for the separator character.

    /foo//               -->   /foo/
    /foo/./              -->   /foo/
    /foo/../bar          -->   /bar
    /foo/../bar/         -->   /bar/
    /foo/../bar/../baz   -->   /baz
    //foo//./bar         -->   /foo/bar
    /../                 -->   null
    ../foo               -->   null
    foo/bar/..           -->   foo/
    foo/../../bar        -->   null
    foo/../bar           -->   bar
    //server/foo/../bar  -->   //server/bar
    //server/../bar      -->   null
    C:\foo\..\bar        -->   C:\bar
    C:\..\bar            -->   null
    ~/foo/../bar/        -->   ~/bar/
    ~/../bar             -->   null
    
    The output will be the same on both Unix and Windows including the separator character.

    unixSeparator

    true if a unix separator should be used or false if a windows separator should be used.

    returns

    the normalized filename, or null if invalid

    Definition Classes
    CommonsFilenameUtils
  99. def notExists : Boolean

    Tests whether the file or directory denoted by this abstract pathname not exists.

    Tests whether the file or directory denoted by this abstract pathname not exists.

    Definition Classes
    CommonsFilePlus
  100. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  101. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  102. def openBufferedInputStream (): BufferedInputStream

    Opens a FileInputStream for the specified file, providing better error messages than simply calling new FileInputStream(file).

    Opens a FileInputStream for the specified file, providing better error messages than simply calling new FileInputStream(file).

    At the end of the method either the stream will be successfully opened, or an exception will have been thrown.

    An exception is thrown if the file does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be read.

    returns

    a new FileInputStream for the specified file

    Definition Classes
    CommonsFileUtils
  103. def openBufferedOutputStream (): BufferedOutputStream

    Opens a FileOutputStream for the specified file, checking and creating the parent directory if it does not exist.

    Opens a FileOutputStream for the specified file, checking and creating the parent directory if it does not exist.

    At the end of the method either the stream will be successfully opened, or an exception will have been thrown.

    The parent directory will be created if it does not exist. The file will be created if it does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be written to. An exception is thrown if the parent directory cannot be created.

    returns

    a new FileOutputStream for the specified file

    Definition Classes
    CommonsFileUtils
  104. def openInputStream (): InputStream

    Opens a FileInputStream for the specified file, providing better error messages than simply calling new FileInputStream(file).

    Opens a FileInputStream for the specified file, providing better error messages than simply calling new FileInputStream(file).

    At the end of the method either the stream will be successfully opened, or an exception will have been thrown.

    An exception is thrown if the file does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be read.

    returns

    a new FileInputStream for the specified file

    Definition Classes
    CommonsFileUtils
  105. def openOutputStream (): OutputStream

    Opens a FileOutputStream for the specified file, checking and creating the parent directory if it does not exist.

    Opens a FileOutputStream for the specified file, checking and creating the parent directory if it does not exist.

    At the end of the method either the stream will be successfully opened, or an exception will have been thrown.

    The parent directory will be created if it does not exist. The file will be created if it does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be written to. An exception is thrown if the parent directory cannot be created.

    returns

    a new FileOutputStream for the specified file

    Definition Classes
    CommonsFileUtils
  106. def parentFile : File

    Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.

    Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.

    Definition Classes
    CommonsFilePlus
  107. def parentPath : String

    Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.

    Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.

    Definition Classes
    CommonsFilePlus
  108. def path : String

    Converts this abstract pathname into a pathname string.

    Converts this abstract pathname into a pathname string.

    Definition Classes
    CommonsFilePlus
  109. def pathMatches (matcher: String, caseSensitivity: IOCase): Boolean

    Checks a filename to see if it matches the specified wildcard matcher allowing control over case-sensitivity.

    Checks a filename to see if it matches the specified wildcard matcher allowing control over case-sensitivity.

    The wildcard matcher uses the characters '?' and '*' to represent a single or multiple (zero or more) wildcard characters. N.B. the sequence "*?" does not work properly at present in match strings.

    caseSensitivity

    what case sensitivity rule to use, null means case-sensitive

    returns

    true if the filename matches the wilcard string

    Definition Classes
    CommonsFilenameUtils
  110. def pathMatches (matcher: String): Boolean

    Checks a filename to see if it matches the specified wildcard matcher using the case rules of the system.

    Checks a filename to see if it matches the specified wildcard matcher using the case rules of the system.

    The wildcard matcher uses the characters '?' and '*' to represent a single or multiple (zero or more) wildcard characters. This is the same as often found on Dos/Unix command lines. The check is case-sensitive on Unix and case-insensitive on Windows.

    wildcardMatch("c.txt", "*.txt")      --> true
    wildcardMatch("c.txt", "*.jpg")      --> false
    wildcardMatch("c.txt", "*.???")      --> true
    wildcardMatch("c.txt", "*.????")     --> false
    
    N.B. the sequence "*?" does not work properly at present in match strings.

    matcher

    the wildcard string to match against

    returns

    true if the filename matches the wilcard string

    Definition Classes
    CommonsFilenameUtils
  111. def prefixLength : Int

    Returns the length of the filename prefix, such as C:/ or ~/.

    Returns the length of the filename prefix, such as C:/ or ~/.

    This method will handle a file in either Unix or Windows format.

    The prefix length includes the first slash in the full filename if applicable. Thus, it is possible that the length returned is greater than the length of the input string.

    Windows:
    a\b\c.txt           --> ""          --> relative
    \a\b\c.txt          --> "\"         --> current drive absolute
    C:a\b\c.txt         --> "C:"        --> drive relative
    C:\a\b\c.txt        --> "C:\"       --> absolute
    \\server\a\b\c.txt  --> "\\server\" --> UNC
    
    Unix:
    a/b/c.txt           --> ""          --> relative
    /a/b/c.txt          --> "/"         --> absolute
    ~/a/b/c.txt         --> "~/"        --> current user
    ~                   --> "~/"        --> current user (slash added)
    ~user/a/b/c.txt     --> "~user/"    --> named user
    ~user               --> "~user/"    --> named user (slash added)
    

    The output will be the same irrespective of the machine that the code is running on. ie. both Unix and Windows prefixes are matched regardless.

    returns

    the length of the prefix, -1 if invalid or null

    Definition Classes
    CommonsFilenameUtils
  112. def readLines (encoding: String = null): List[String]

    Reads the contents of a file line by line to a List of Strings.

    Reads the contents of a file line by line to a List of Strings. The file is always closed.

    encoding

    the encoding to use, null means platform default

    returns

    the list of Strings representing each line in the file, never null

    Definition Classes
    CommonsFileUtils
  113. def readToByteArray (): Array[Byte]

    Reads the contents of a file into a byte array.

    Reads the contents of a file into a byte array. The file is always closed.

    returns

    the file contents, never null

    Definition Classes
    CommonsFileUtils
  114. def readToString (encoding: String = null): String

    Reads the contents of a file into a String.

    Reads the contents of a file into a String. The file is always closed.

    encoding

    the encoding to use, null means platform default

    returns

    the file contents, never null

    Definition Classes
    CommonsFileUtils
  115. def removeExtensionPath : String

    Removes the extension from a filename.

    Removes the extension from a filename.

    This method returns the textual part of the filename before the last dot. There must be no directory separator after the dot.

    foo.txt    --> foo
    a\b\c.jpg  --> a\b\c
    a\b\c      --> a\b\c
    a.b\c      --> a.b\c
    

    The output will be the same irrespective of the machine that the code is running on.

    returns

    the filename minus the extension

    Definition Classes
    CommonsFilenameUtils
  116. def separatorsToSystem : String

    Converts all separators to the Windows separator of backslash.

    Converts all separators to the Windows separator of backslash.

    returns

    the updated path

    Definition Classes
    CommonsFilenameUtils
  117. def separatorsToUnix : String

    Converts all separators to the Unix separator of forward slash.

    Converts all separators to the Unix separator of forward slash.

    returns

    the updated path

    Definition Classes
    CommonsFilenameUtils
  118. def separatorsToWindows : String

    Converts all separators to the Windows separator of backslash.

    Converts all separators to the Windows separator of backslash.

    returns

    the updated path

    Definition Classes
    CommonsFilenameUtils
  119. def sizeOf : Long

    Returns the size of the specified file or directory.

    Returns the size of the specified file or directory. If the provided File is a regular file, then the file's length is returned. If the argument is a directory, then the size of the directory is calculated recursively. If a directory or subdirectory is security restricted, its size will not be included.

    returns

    the length of the file, or recursive size of the directory, provided (in bytes).

    Definition Classes
    CommonsFileUtils
  120. def sizeOfDirectory : Long

    Counts the size of a directory recursively (sum of the length of all files).

    Counts the size of a directory recursively (sum of the length of all files).

    returns

    size of directory in bytes, 0 if directory is security restricted

    Definition Classes
    CommonsFileUtils
  121. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  122. val that : File

    Attributes
    protected
    Definition Classes
    CommonsFileCommonsFilenameUtilsCommonsFileUtilsCommonsFilePlus
  123. def toString (): String

    Definition Classes
    AnyRef → Any
  124. def totalSpace : Long

    Returns the size of the partition named by this abstract pathname.

    Returns the size of the partition named by this abstract pathname.

    Definition Classes
    CommonsFilePlus
  125. def touch (): Unit

    Implements the same behaviour as the "touch" utility on Unix.

    Implements the same behaviour as the "touch" utility on Unix. It creates a new file with size 0 or, if the file exists already, it is opened and closed without modifying it, but updating the file date and time.

    NOTE: As from v1.3, this method throws an IOException if the last modified date of the file cannot be set. Also, as from v1.3 this method creates parent directories if they do not exist.

    Definition Classes
    CommonsFileUtils
  126. def usableSpace : Long

    Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname.

    Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname.

    Definition Classes
    CommonsFilePlus
  127. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  128. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  129. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  130. def waitFor (second: Int): Boolean

    Waits for NFS to propagate a file creation, imposing a timeout.

    Waits for NFS to propagate a file creation, imposing a timeout.

    This method repeatedly tests File#exists() until it returns true up to the maximum time specified in seconds.

    returns

    true if file exists

    Definition Classes
    CommonsFileUtils
  131. def write (data: Array[Byte]): File

    Writes a byte array to a file creating the file if it does not exist.

    Writes a byte array to a file creating the file if it does not exist.

    NOTE: the parent directories of the file will be created if they do not exist.

    data

    the content to write to the file

    returns

    this file

    Definition Classes
    CommonsFileUtils
  132. def write (data: CharSequence, encoding: String = null): File

    Writes a CharSequence to a file creating the file if it does not exist using the default encoding for the VM.

    Writes a CharSequence to a file creating the file if it does not exist using the default encoding for the VM.

    data

    the content to write to the file

    returns

    this file

    Definition Classes
    CommonsFileUtils
  133. def writeLines [T] (lines: Seq[T], encoding: String, lineEnding: String): File

    Writes the toString() value of each item in a collection to the specified File line by line.

    Writes the toString() value of each item in a collection to the specified File line by line. The specified character encoding and the line ending will be used.

    NOTE: the parent directories of the file will be created if they do not exist.

    lines

    the lines to write, null entries produce blank lines

    encoding

    the encoding to use, null means platform default

    lineEnding

    the line separator to use, null is system default

    returns

    this file

    Definition Classes
    CommonsFileUtils

Inherited from CommonsFilenameUtils

Inherited from CommonsFileUtils

Inherited from CommonsFilePlus

Inherited from AnyRef

Inherited from Any