private void copy ( OutputStream out , File in ) throws IOException { FileInputStream inStream = null ; try { inStream = new FileInputStream ( in ) ; byte [ ] buffer = new byte [ 4096 ] ; int len ; while ( ( len = inStream . read ( buffer ) ) != - 1 ) { out . write ( buffer , 0 , len ) ; } } finally { if ( inStream != null ) { inStream . close ( ) ; } } }
Copies the file to the output stream