code: @Override
      public 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;
          }
  
          byte[] next = ensureDataAvailable(true);
          if (next == null) {
              return -1;
          }
          int numRead = Math.min(next.length - index, len);
          System.arraycopy(next, index, b, off, numRead);
          index += numRead;
          return numRead;
      }
docs: read(byte[]) delegates to this