code: private void writeToBuffers(byte[] value, int start, int len) throws IOException {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "Writing " + len + ", buffered=" + this.bufferedCount);
          }
          if (value.length < (start + len)) {
              throw new IllegalArgumentException("Length outside value range");
          }
          this.writing = true;
          int remaining = len;
          int offset = start;
          while (0 < remaining) {
              WsByteBuffer buffer = getBuffer();
              int avail = buffer.remaining();
              if (contentLengthSet && bytesRemaining < bufferedCount + remaining) {
                  //write what we can and throw an exception - it will be caught in servletWrapper
                  int numberToWrite = (int) bytesRemaining - bufferedCount;
                  boolean throwExceptionThisTime = true;
                  if (numberToWrite > avail) {
                      numberToWrite = avail;
                      throwExceptionThisTime = false;
                  }
                  this.bufferedCount += numberToWrite;
                  buffer.put(value, offset, numberToWrite);
                  remaining = remaining - numberToWrite;
                  if (throwExceptionThisTime) {
                      throw new WriteBeyondContentLengthException();
                  }
              }
              if (avail >= remaining) {
                  // write all remaining data
                  this.bufferedCount += remaining;
                  buffer.put(value, offset, remaining);
                  remaining = 0;
              } else {
                  // write what we can
                  this.bufferedCount += avail;
                  buffer.put(value, offset, avail);
                  offset += avail;
                  remaining -= avail;
              }
              if (this.bufferedCount >= this.amountToBuffer) {
                  this.ignoreFlush = false;
                  flushBuffers();
              }
          }
      }
docs: Write the given information to the output buffers.
  If it went async during flush , save the remaining data and stop.
  When callback on complete, write the remaining data.
  
  @param value
  @param start - offset into value
  @param len - length from that offset to write
  @throws IOException