code: private void parsePreamble(ByteBuffer buffer) {
          if (_partialBoundary > 0) {
              int partial = _delimiterSearch.startsWith(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining(), _partialBoundary);
              if (partial > 0) {
                  if (partial == _delimiterSearch.getLength()) {
                      buffer.position(buffer.position() + partial - _partialBoundary);
                      _partialBoundary = 0;
                      setState(State.DELIMITER);
                      return;
                  }
  
                  _partialBoundary = partial;
                  BufferUtils.clear(buffer);
                  return;
              }
  
              _partialBoundary = 0;
          }
  
          int delimiter = _delimiterSearch.match(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
          if (delimiter >= 0) {
              buffer.position(delimiter - buffer.arrayOffset() + _delimiterSearch.getLength());
              setState(State.DELIMITER);
              return;
          }
  
          _partialBoundary = _delimiterSearch.endsWith(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
          BufferUtils.clear(buffer);
      }
docs: /* -------------------------------------------------------------------------------