Class FileUtil


  • public final class FileUtil
    extends java.lang.Object
    File Util class
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static FileUtil getInstance()
      Get the instance
      java.lang.String readFileContent​(java.io.File file)
      Read the file content
      java.lang.String readFileContent​(java.io.File file, java.nio.charset.Charset charset)
      Read the file content
      java.lang.String readFileContent​(java.nio.file.Path file)
      Read the file content
      java.lang.String readFileContent​(java.nio.file.Path file, java.nio.charset.Charset charset)
      Read the file content
      • Methods inherited from class java.lang.Object

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

      • getInstance

        public static FileUtil getInstance()
        Get the instance
        Returns:
        the instance
      • readFileContent

        public java.lang.String readFileContent​(java.io.File file)
                                         throws java.io.IOException
        Read the file content
        Parameters:
        file - the file
        Returns:
        the content
        Throws:
        java.io.IOException - In case of an IO error
      • readFileContent

        public java.lang.String readFileContent​(java.nio.file.Path file)
                                         throws java.io.IOException
        Read the file content
        Parameters:
        file - the file
        Returns:
        the content
        Throws:
        java.io.IOException - In case of an IO error
      • readFileContent

        public java.lang.String readFileContent​(java.io.File file,
                                                java.nio.charset.Charset charset)
                                         throws java.io.IOException
        Read the file content
        Parameters:
        file - the file
        charset - the charset
        Returns:
        the content
        Throws:
        java.io.IOException - In case of an IO error
      • readFileContent

        public java.lang.String readFileContent​(java.nio.file.Path file,
                                                java.nio.charset.Charset charset)
                                         throws java.io.IOException
        Read the file content
        Parameters:
        file - the file
        charset - the charset
        Returns:
        the content
        Throws:
        java.io.IOException - In case of an IO error