Android examples for File Input Output:Copy File
copy from Reader to Writer
//package com.book2s; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; public class Main { private static int copy(Reader input, Writer output) throws IOException { char[] buffer = new char[1024 * 4]; int count = 0; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n);//from www .j a v a 2 s . co m count += n; } return count; } public static int copy(InputStream input, OutputStream output) throws IOException { byte[] buffer = new byte[1024 * 4]; int count = 0; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } return count; } }