Class FileUtil


  • public class FileUtil
    extends java.lang.Object
    This class contains util method related to File handeling.
    Since:
    1.0 Nov 11, 2005
    Version:
    1.0
    Author:
    http://cheenath.com
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EOL
      end of line
    • Constructor Summary

      Constructors 
      Constructor Description
      FileUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void copy​(java.io.InputStream from, boolean closeInput, java.io.OutputStream to, boolean closeOutput)  
      static void copy​(java.io.InputStream from, java.io.OutputStream to)  
      static void copy​(java.io.InputStream from, java.io.OutputStream to, boolean closeOutput)  
      static boolean deleteDir​(java.io.File dir)  
      static java.io.File getSystemTempDirectory​(java.io.File parentTempDir)  
      static java.util.List<java.io.File> listFilesRecursive​(java.io.File dir, boolean includeDirs)  
      static java.io.File makeTempDirectory​(java.io.File parentTempDir, java.lang.String dirName, boolean deleteIfExists)  
      static java.io.File makeTempDirectory​(java.lang.String dirName, boolean deleteIfExists)  
      static java.io.File mkdirs​(java.lang.String packageName, java.io.File root)  
      static byte[] toBytes​(java.io.InputStream in)  
      static java.lang.String toString​(java.io.File file)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EOL

        public static final java.lang.String EOL
        end of line
    • Constructor Detail

      • FileUtil

        public FileUtil()
    • Method Detail

      • toString

        public static java.lang.String toString​(java.io.File file)
                                         throws java.io.IOException
        Parameters:
        file -
        Returns:
        Throws:
        java.io.IOException
      • toBytes

        public static byte[] toBytes​(java.io.InputStream in)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static void copy​(java.io.InputStream from,
                                java.io.OutputStream to)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static void copy​(java.io.InputStream from,
                                java.io.OutputStream to,
                                boolean closeOutput)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static void copy​(java.io.InputStream from,
                                boolean closeInput,
                                java.io.OutputStream to,
                                boolean closeOutput)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • mkdirs

        public static java.io.File mkdirs​(java.lang.String packageName,
                                          java.io.File root)
      • deleteDir

        public static boolean deleteDir​(java.io.File dir)
      • listFilesRecursive

        public static java.util.List<java.io.File> listFilesRecursive​(java.io.File dir,
                                                                      boolean includeDirs)
      • makeTempDirectory

        public static java.io.File makeTempDirectory​(java.lang.String dirName,
                                                     boolean deleteIfExists)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • makeTempDirectory

        public static java.io.File makeTempDirectory​(java.io.File parentTempDir,
                                                     java.lang.String dirName,
                                                     boolean deleteIfExists)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • getSystemTempDirectory

        public static java.io.File getSystemTempDirectory​(java.io.File parentTempDir)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException