public synchronized int read(byte b[],int off,int len) throws IOException {
  ensureOpen();
  if ((off < 0) || (off > b.length) || (len < 0)|| ((off + len) > b.length)|| ((off + len) < 0)) {
    throw new IndexOutOfBoundsException();
  }
 else   if (len == 0) {
    return 0;
  }
  int avail=chunkCount - chunkPos;
  if (avail <= 0) {
    if (state == STATE_READING_CHUNK) {
      return fastRead(b,off,len);
    }
    avail=readAhead(true);
    if (avail < 0) {
      return -1;
    }
  }
  int cnt=(avail < len) ? avail : len;
  System.arraycopy(chunkData,chunkPos,b,off,cnt);
  chunkPos+=cnt;
  return cnt;
}

public synchronized int read ( byte b [ ] , int off , int len ) throws IOException { ensureOpen ( ) ; if ( ( off < 0 ) || ( off > b . length ) || ( len < 0 ) || ( ( off + len ) > b . length ) || ( ( off + len ) < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return 0 ; } int avail = chunkCount - chunkPos ; if ( avail <= 0 ) { if ( state == STATE_READING_CHUNK ) { return fastRead ( b , off , len ) ; } avail = readAhead ( true ) ; if ( avail < 0 ) { return - 1 ; } } int cnt = ( avail < len ) ? avail : len ; System . arraycopy ( chunkData , chunkPos , b , off , cnt ) ; chunkPos += cnt ; return cnt ; }
reads bytes from this stream into the specified byte array , starting at the given offset .
