static long copyStreamToDevNull(InputStream in) ctex { try { byte[] buf = new byte[65536]; long total = 0; while (true) { int n = in.read(buf); total += n; if (n <= 0) return total; } } finally { in.close(); } }