Class FileUtils


  • public class FileUtils
    extends java.lang.Object
    Methods to work easier with Files.
    Author:
    f.conrads
    • Constructor Summary

      Constructors 
      Constructor Description
      FileUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int countLines​(java.io.File filename)
      Counts the lines in a file efficently Props goes to: http://stackoverflow.com/a/453067/2917596
      static int getHashcodeFromFileContent​(java.lang.String filepath)  
      static java.lang.String readFile​(java.lang.String path)  
      static java.lang.String readLineAt​(int pos, java.io.File filename)
      Returns a line at a given position of a File
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileUtils

        public FileUtils()
    • Method Detail

      • countLines

        public static int countLines​(java.io.File filename)
                              throws java.io.IOException
        Counts the lines in a file efficently Props goes to: http://stackoverflow.com/a/453067/2917596
        Parameters:
        filename - File to count lines of
        Returns:
        No. of lines in File
        Throws:
        java.io.IOException
      • readLineAt

        public static java.lang.String readLineAt​(int pos,
                                                  java.io.File filename)
                                           throws java.io.IOException
        Returns a line at a given position of a File
        Parameters:
        pos - line which should be returned
        filename - File in which the queries are stated
        Returns:
        line at pos
        Throws:
        java.io.IOException
      • getHashcodeFromFileContent

        public static int getHashcodeFromFileContent​(java.lang.String filepath)
      • readFile

        public static java.lang.String readFile​(java.lang.String path)
                                         throws java.io.IOException
        Throws:
        java.io.IOException