Java 8 File to String in One Line

public static void main(String[] args) throws IOException {
    String result = new String(Files.readAllBytes(Paths.get("/tmp/result.txt")));
}

 

 

dicksonkho

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.