@Override public synchronized int read(byte b[],int off,int len) throws IOException {
  if (b == null) {
    throw new NullPointerException();
  }
 else   if (off < 0 || len < 0 || len > b.length - off) {
    throw new IndexOutOfBoundsException();
  }
 else   if (len == 0) {
    return 0;
  }
  if (c.checkEOF()) {
    return -1;
  }
  try {
    while (r.available() == 0) {
      c.readDataRecord(r);
      if (c.checkEOF()) {
        return -1;
      }
    }
    int howmany=Math.min(len,r.available());
    howmany=r.read(b,off,howmany);
    return howmany;
  }
 catch (  Exception e) {
    c.handleException(e);
    return -1;
  }
}

@ Override public synchronized int read ( byte b [ ] , int off , int len ) throws IOException { if ( b == null ) { throw new NullPointerException ( ) ; } else if ( off < 0 || len < 0 || len > b . length - off ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return 0 ; } if ( c . checkEOF ( ) ) { return - 1 ; } try { while ( r . available ( ) == 0 ) { c . readDataRecord ( r ) ; if ( c . checkEOF ( ) ) { return - 1 ; } } int howmany = Math . min ( len , r . available ( ) ) ; howmany = r . read ( b , off , howmany ) ; return howmany ; } catch ( Exception e ) { c . handleException ( e ) ; return - 1 ; } }
read up to " len " bytes into this buffer , starting at " off " . if the layer above needs more data , it asks for more , so we are responsible only for blocking to fill at most one buffer , and returning " - 1 " on non - fault eof status .
