adam bien's blog

Java 8: Reading A File Into A String 📎


import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

    public static void main(String[] args) throws IOException {
        String content = new String(Files.readAllBytes(Paths.get("duke.java")));
    }

Enjoy Java 8!