### Question:
ProcFSUtils { protected static ProcPidIO parsePidIO(String output) { String[] lines = output.split("\n"); if (lines.length < 7) { throw new RuntimeException("Unable to parse output of /proc/pid/io:\n" + output); } long rchar = -1; long wchar = -1; long readBytes = -1; long writeBytes = -1; for (String line: lines) { if ("".equals(line)) continue; String[] cols = line.split(": +"); if (cols.length < 2) { throw new RuntimeException("Unable to parse line in output of /proc/pid/io:\n" + line); } String key = cols[0]; switch (key) { case "rchar": rchar = Long.parseLong(cols[1]); break; case "wchar": wchar = Long.parseLong(cols[1]); break; case "read_bytes": readBytes = Long.parseLong(cols[1]); break; case "write_bytes": writeBytes = Long.parseLong(cols[1]); break; } } if (rchar < 0 || wchar < 0 || readBytes < 0 || writeBytes < 0) { throw new RuntimeException("Missing field in output of /proc/pid/io:\n" + output); } return new ProcPidIO(rchar, wchar, readBytes, writeBytes); }  static boolean isAvailable(); static int[] getChildrenPids(int rootPid); static ProcPidStat stat(int pid); static ProcPidStat[] stat(int[] pids); static ProcStat stat(); static ProcPidIO io(int pid); static ProcPidIO[] io(int[] pids); static ProcNetIO netio(); static ProcSmaps[] smaps(int[] pids); static ProcSmaps[] smaps(int pid); static final String READ_ONLY_WITH_SHARED_PERMISSION; static final String READ_EXECUTE_WITH_SHARED_PERMISSION; }### Answer:
@Test public void parsePidIO() throws Exception { String output = "rchar: 15206255\n" + "wchar: 1117\n" + "syscr: 2449\n" + "syscw: 24\n" + "read_bytes: 880640\n" + "write_bytes: 36864\n" + "cancelled_write_bytes: 0\n"; ProcFSUtils.ProcPidIO io = ProcFSUtils.parsePidIO(output); assertEquals(15206255L, io.rchar); assertEquals(1117L, io.wchar); assertEquals(880640L, io.readBytes); assertEquals(36864L, io.writeBytes); }