public long copy(final InputStream from,final OutputStream to) throws IOException {
  long count=0;
  byte[] tmp=mByteArrayPool.get(mTempBufSize);
  try {
    while (true) {
      int read=from.read(tmp,0,mTempBufSize);
      if (read == -1) {
        return count;
      }
      to.write(tmp,0,read);
      count+=read;
    }
  }
  finally {
    mByteArrayPool.release(tmp);
  }
}

public long copy ( final InputStream from , final OutputStream to ) throws IOException { long count = 0 ; byte [ ] tmp = mByteArrayPool . get ( mTempBufSize ) ; try { while ( true ) { int read = from . read ( tmp , 0 , mTempBufSize ) ; if ( read == - 1 ) { return count ; } to . write ( tmp , 0 , read ) ; count += read ; } } finally { mByteArrayPool . release ( tmp ) ; } }
copy all bytes from inputstream to outputstream .
