code: private int writeAtMost(byte[] b, int off, int len) throws IOException {
      if (this.curr_ >= this.hi_) {
        if (this.hitEOF_ && this.hi_ < this.maxHi_) {
          // at EOF -- bump "hi"
          this.hi_ = this.maxHi_;
        } else {
          // slow path -- write current buffer; read next one
          this.seek(this.curr_);
          if (this.curr_ == this.hi_) {
            // appending to EOF -- bump "hi"
            this.hi_ = this.maxHi_;
          }
        }
      }
      len = Math.min(len, (int) (this.hi_ - this.curr_));
      int buffOff = (int) (this.curr_ - this.lo_);
      System.arraycopy(b, off, this.buff_, buffOff, len);
      this.curr_ += len;
      return len;
    }
docs: /*
  Write at most "len" bytes to "b" starting at position "off", and return
  the number of bytes written.