BufferedInputStream bin = new BufferedInputStream(in); BufferedOutputStream bout = new BufferedOutputStream(out); while (true) { int datum = bin.read(); if (datum == -1) break; bout.write(datum); } bout.flush();
try { copy(System.in, System.out); } catch (IOException ex) { System.err.println(ex); }