private static void copyWithProgress(Action1<Float> progress,long contentLength,InputStream inputStream,OutputStream outputStream) throws IOException {
  long totalCount=0;
  byte[] buffer=new byte[1024 * 64];
  int count;
  while ((count=ByteStreams.read(inputStream,buffer,0,buffer.length)) > 0) {
    outputStream.write(buffer,0,count);
    totalCount+=count;
    progress.call((float)totalCount / contentLength);
  }
}

private static void copyWithProgress ( Action1 < Float > progress , long contentLength , InputStream inputStream , OutputStream outputStream ) throws IOException { long totalCount = 0 ; byte [ ] buffer = new byte [ 1024 * 64 ] ; int count ; while ( ( count = ByteStreams . read ( inputStream , buffer , 0 , buffer . length ) ) > 0 ) { outputStream . write ( buffer , 0 , count ) ; totalCount += count ; progress . call ( ( float ) totalCount / contentLength ) ; } }
copies from the input stream to the output stream . the progress is written to the given observable .
