Here you can find the source of save(InputStream is, OutputStream os)
static void save(InputStream is, OutputStream os) throws IOException
//package com.java2s; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { static void save(InputStream is, OutputStream os) throws IOException { byte[] inbuf = new byte[1024]; do {/* w w w . j a v a 2 s. c o m*/ int nCount = is.read(inbuf); if (nCount > 0) { os.write(inbuf, 0, nCount); } } while (is.available() > 0); } }