Files.readString(path) is fine for small or moderate files, but it loads the entire file into memory. For large files, you should stream instead. Use something like BufferedReader, Files.lines(path), or an InputStream so you can process the file incrementally without holding the whole thing in RAM.