Android examples for java.io:InputStream
copy File from InputStream to OutputStream
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { /**// w w w . j a v a 2 s . co m * Copy file. * * @param in * Input file (source). * @param out * Output file (destination). * @throws IOException */ public static void copyFile(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[1024]; int read; while ((read = in.read(buffer)) != -1) { out.write(buffer, 0, read); } } }