public static String readFileAsString(String path) throws IOException {
        try {
            byte[] allBytes = Files.readAllBytes(Paths.get(path));
            return new String(allBytes, StandardCharsets.UTF_8);
        } catch (IOException ex) {
            throw new IOException("Unable to read file " + path, ex);
        }
    }
Read a file as string and return the content. The file is treated as a stream and no seek is performed.
This allows the program to read from a regular file as well as from a pipe/fifo.
clients/src/main/java/org/apache/kafka/common/utils/Utils.java