Here you can find the source of appendFile(OutputStream output, File source)
private static void appendFile(OutputStream output, File source) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { private static void appendFile(OutputStream output, File source) throws IOException { InputStream input = null; try {//from w ww .j a v a 2 s. c o m input = new BufferedInputStream(new FileInputStream(source)); byte[] buf = new byte[1024]; int len; while ((len = input.read(buf)) > 0) { output.write(buf, 0, len); } } finally { input.close(); } } }