Many Correct Answers
Let’s copy a file with bad Java I/O: private void copy(File source, File target) throws IOException { try (InputStream in = new FileInputStream(source); OutputStream out = new FileOutputStream(target)) { while (true) { int b = in.read(); if (b == -1) break; out.write(b); } } } Whoops, it’s super slow. Reading a…