Class FileUtils


  • public class FileUtils
    extends java.lang.Object
    Random file manipulation utilities that don't really have any other good place to live.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void deleteDir​(java.io.File path)
      Recursively delete a directory and all the files it contains.
      static java.lang.String getBaseName​(java.lang.String fileName)
      Return the base name without the extension of this file name.
      static java.lang.String getExtension​(java.lang.String fileName)
      Return the file name extension of this file name.
      • 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

      • deleteDir

        public static void deleteDir​(java.io.File path)
                              throws java.io.IOException
        Recursively delete a directory and all the files it contains.
        Parameters:
        path - path to delete
        Throws:
        java.io.IOException - if the delete fails
      • getExtension

        public static java.lang.String getExtension​(java.lang.String fileName)
        Return the file name extension of this file name. If the file name does not have an extension, return null.
        Parameters:
        fileName - file name with a possible extension
        Returns:
        the extension, or null if there is no extension
      • getBaseName

        public static java.lang.String getBaseName​(java.lang.String fileName)
        Return the base name without the extension of this file name. If the file name does not have an extension, return the entire name.
        Parameters:
        fileName - file name with a possible extension
        Returns:
        the base name without the extension, or the whole fileName if there is no extension