code: private IOException checkForErrors(long numBytes, boolean async) {
          IOException exception = null;
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "checkForErrors: numBytes=" + numBytes
                           + " buffers=" + SSLUtils.getBufferTraceInfo(getBuffers()));
          }
  
          // Extract the buffers provided by the calling channel.
          WsByteBuffer callerBuffers[] = getBuffers();
          if (callerBuffers == null || callerBuffers.length == 0) {
              exception = new IOException("No buffer(s) provided for writing data.");
          } else if ((numBytes < -1) || (numBytes == 0) && (async)) {
              // NumBytes requested must be -1 (write all) or positive
              exception = new IOException("Number of bytes requested, " + numBytes + " is not valid.");
          } else {
              // Ensure buffer provided by caller is big enough to contain the number of bytes requested.
              int bytesAvail = WsByteBufferUtils.lengthOf(callerBuffers);
              if (bytesAvail < numBytes) {
                  exception = new IOException("Number of bytes requested, "
                                              + numBytes + " exceeds space remaining in the buffers provided: "
                                              + bytesAvail);
              }
          }
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() && exception != null) {
              Tr.debug(tc, "Found error, exception generated: " + exception);
          }
          return exception;
      }
docs: Check the status of the buffers set by the caller taking into account
  the JITAllocation size if the buffers are null or verifying there is
  space available in the the buffers based on the size of data requested.
  
  @param numBytes
  @param async
  @return IOException if an inconsistency/error is found in the request,
  null otherwise.