public static void copyStream(InputStream is,OutputStream os,byte[] buffer,int bufferSize,String confid,double fileSize,Context context) throws IOException {
  double downloaded=0;
  int[] update=new int[3];
  try {
    for (; ; ) {
      int count=is.read(buffer,0,bufferSize);
      downloaded+=count;
      if (count == -1) {
        if (context != null) {
        }
        break;
      }
      os.write(buffer,0,count);
      if (context != null) {
        update[0]=(int)downloaded;
        update[1]=(int)fileSize;
        update[2]=(int)((downloaded / fileSize) * 100);
      }
    }
  }
 catch (  IOException e) {
    throw e;
  }
}

public static void copyStream ( InputStream is , OutputStream os , byte [ ] buffer , int bufferSize , String confid , double fileSize , Context context ) throws IOException { double downloaded = 0 ; int [ ] update = new int [ 3 ] ; try { for ( ; ; ) { int count = is . read ( buffer , 0 , bufferSize ) ; downloaded += count ; if ( count == - 1 ) { if ( context != null ) { } break ; } os . write ( buffer , 0 , count ) ; if ( context != null ) { update [ 0 ] = ( int ) downloaded ; update [ 1 ] = ( int ) fileSize ; update [ 2 ] = ( int ) ( ( downloaded / fileSize ) * 100 ) ; } } } catch ( IOException e ) { throw e ; } }
copy from one stream to another . throws ioexception in the event of error ( for example , sd card is full )
