private boolean updateValues(long now) {
        synchronized (this) {
            try {
                cachedReadBytes = -1L;
                cachedWriteBytes = -1L;
                List<String> lines = Files.readAllLines(path, StandardCharsets.UTF_8);
                for (String line : lines) {
                    if (line.startsWith(READ_BYTES_PREFIX)) {
                        cachedReadBytes = Long.parseLong(line.substring(READ_BYTES_PREFIX.length()));
                    } else if (line.startsWith(WRITE_BYTES_PREFIX)) {
                        cachedWriteBytes = Long.parseLong(line.substring(WRITE_BYTES_PREFIX.length()));
                    }
                }
                lastUpdateMs = now;
                return true;
            } catch (Throwable t) {
                LOG.warn("Unable to update IO metrics", t);
                return false;
            }
        }
    }
Read /proc/self/io.
Generally, each line in this file contains a prefix followed by a colon and a number.
For example, it might contain this:
rchar: 4052
wchar: 0
syscr: 13
syscw: 0
read_bytes: 0
write_bytes: 0
cancelled_write_bytes: 0
server/src/main/java/org/apache/kafka/server/metrics/LinuxIoMetricsCollector.java