static void copyStream(InputStream in, OutputStream out) ctex { byte buf[] = new byte[1024]; int l; while (true) { l = in.read(buf); if (l <= 0) break; out.write(buf, 0, l); } }