void pipeStream(InputStream &source, OutputStream &dest) { for (;;) { int ch = source.get(); if (ch<0) break; dest.put(ch); } dest.flush(); }