java8/src/main/java/com/company/FileReader.java
public String nioBufferedReader(String filepath) {
        StringBuilder lines = new StringBuilder();
        int lineCount = 0;
        try {
            BufferedReader reader = Files.newBufferedReader(Paths.get(filepath), StandardCharsets.UTF_8);
            String line;
            while( (line = reader.readLine()) != null ) {
                //System.out.println(line);
                lines.append(line+"\n");
                lineCount++;
            }
        } catch (IOException exception) {
            System.out.println("nioBufferedReader() - IOException: " + exception.toString());
        }

        System.out.println("nioBufferedReader() - lineCount: " + lineCount);

        return lines.toString();
    }
/**
     * Reads file one line at a time using Files.newBufferedReader() and StringBuilder()
     * 26ms - use of StringBuilder actually makes this method slower than nioFilesReadAllBytes()
     * @param filepath
     * @return
     */
Reads file one line at a time using Files.newBufferedReader() and StringBuilder()
26ms - use of StringBuilder actually makes this method slower than nioFilesReadAllBytes()
@param filepath
@return
Reads file one line at a time using Files . newBufferedReader () and StringBuilder () 26ms - use of StringBuilder actually makes this method slower than nioFilesReadAllBytes () @param filepath @return
public String nioBufferedReader(String filepath) {
        StringBuilder lines = new StringBuilder();
        int lineCount = 0;
        try {
            BufferedReader reader = Files.newBufferedReader(Paths.get(filepath), StandardCharsets.UTF_8);
            String line;
            while( (line = reader.readLine()) != null ) {
                lines.append(line+"\n");
                lineCount++;
            }
        } catch (IOException exception) {
            System.out.println("nioBufferedReader() - IOException: " + exception.toString());
        }
        System.out.println("nioBufferedReader() - lineCount: " + lineCount);
        return lines.toString();
    }
public String nioBufferedReader ( String filepath ) { StringBuilder lines = new StringBuilder ( ) ; int lineCount = 0 ; try { BufferedReader reader = Files . newBufferedReader ( Paths . get ( filepath ) , StandardCharsets . UTF_8 ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { lines . append ( line + "\n" ) ; lineCount ++ ; } } catch ( IOException exception ) { System . out . println ( "nioBufferedReader() - IOException: " + exception . toString ( ) ) ; } System . out . println ( "nioBufferedReader() - lineCount: " + lineCount ) ; return lines . toString ( ) ; }
Reads file one line at a time using Files.newBufferedReader() and StringBuilder()
 26ms - use of StringBuilder actually makes this method slower than nioFilesReadAllBytes()
 @param filepath
 @return
Reads file one line at a time using Files . newBufferedReader () and StringBuilder () 26ms - use of StringBuilder actually makes this method slower than nioFilesReadAllBytes () @param filepath @return
//System.out.println(line);