public static void transfer(InputStream in,OutputStream out,int bufferSize) throws IOException {
  byte[] buffer=new byte[bufferSize];
  int bytesRead;
  while ((bytesRead=in.read(buffer)) != -1) {
    out.write(buffer,0,bytesRead);
  }
}

public static void transfer ( InputStream in , OutputStream out , int bufferSize ) throws IOException { byte [ ] buffer = new byte [ bufferSize ] ; int bytesRead ; while ( ( bytesRead = in . read ( buffer ) ) != - 1 ) { out . write ( buffer , 0 , bytesRead ) ; } }
copies data from an input stream to an output stream using a buffer of specified size .
