@Override public int read(byte[] buf,int offset,int len) throws IOException {
  int available=_available;
  if (available > 0) {
    len=Math.min(len,available);
    len=_next.read(buf,offset,len);
    if (len > 0) {
      _available-=len;
    }
  }
 else   if (available == 0) {
    _available=readChunkLength();
    if (_available > 0) {
      len=Math.min(len,_available);
      len=_next.read(buf,offset,len);
      if (len > 0)       _available-=len;
    }
 else {
      _available=-1;
      len=-1;
    }
  }
 else {
    len=-1;
  }
  return len;
}

@ Override public int read ( byte [ ] buf , int offset , int len ) throws IOException { int available = _available ; if ( available > 0 ) { len = Math . min ( len , available ) ; len = _next . read ( buf , offset , len ) ; if ( len > 0 ) { _available -= len ; } } else if ( available == 0 ) { _available = readChunkLength ( ) ; if ( _available > 0 ) { len = Math . min ( len , _available ) ; len = _next . read ( buf , offset , len ) ; if ( len > 0 ) _available -= len ; } else { _available = - 1 ; len = - 1 ; } } else { len = - 1 ; } return len ; }
reads more data from the input stream .
