void () { Reader reader = new InputStreamReader(myInput, StandardCharsets.UTF_8); do { int ch = 0; try { ch = reader.read(); } catch (IOException e) { e.printStackTrace(); } if (ch == -1) break; myOutput.print((char) ch); } while (true); }