private static void copy(InputStream i,OutputStream o,int bufferSize) throws IOException {
  try {
    byte[] buffer=new byte[bufferSize];
    int size=i.read(buffer);
    while (size > -1) {
      o.write(buffer,0,size);
      size=i.read(buffer);
    }
  }
  finally {
    sCleanup(o);
    sCleanup(i);
  }
}

private static void copy ( InputStream i , OutputStream o , int bufferSize ) throws IOException { try { byte [ ] buffer = new byte [ bufferSize ] ; int size = i . read ( buffer ) ; while ( size > - 1 ) { o . write ( buffer , 0 , size ) ; size = i . read ( buffer ) ; } } finally { sCleanup ( o ) ; sCleanup ( i ) ; } }
copy the input stream into the output stream , closes both streams when finishing or in a case of an exception
