docs: public void decode(ByteBuffer buffer, boolean moreData) throws HpackException {
          while (buffer.hasRemaining()) {
              int originalPos = buffer.position();
              byte b = buffer.get();
              if ((b & 0b10000000) != 0) {
                  first = false;
                  //if the first bit is set it is an indexed header field
                  buffer.position(buffer.position() - 1); //unget the byte
                  int index = Hpack.decodeInteger(buffer, 7); //prefix is 7
                  if (index == -1) {
                      if(!moreData) {
                          throw UndertowMessages.MESSAGES.hpackFailed();
                      }
                      buffer.position(originalPos);
                      return;
                  } else if(index == 0) {
                      throw UndertowMessages.MESSAGES.zeroNotValidHeaderTableIndex();
                  }
                  handleIndex(index);
              } else if ((b & 0b01000000) != 0) {
                  first = false;
                  //Literal Header Field with Incremental Indexing
                  HttpString headerName = readHeaderName(buffer, 6);
                  if (headerName == null) {
                      if(!moreData) {
                          throw UndertowMessages.MESSAGES.hpackFailed();
                      }
                      buffer.position(originalPos);
                      return;
                  }
                  String headerValue = readHpackString(buffer);
                  if (headerValue == null) {
                      if(!moreData) {
                          throw UndertowMessages.MESSAGES.hpackFailed();
                      }
                      buffer.position(originalPos);
                      return;
                  }
                  headerEmitter.emitHeader(headerName, headerValue, false);
                  addEntryToHeaderTable(new HeaderField(headerName, headerValue));
              } else if ((b & 0b11110000) == 0) {
                  first = false;
                  //Literal Header Field without Indexing
                  HttpString headerName = readHeaderName(buffer, 4);
                  if (headerName == null) {
                      if(!moreData) {
                          throw UndertowMessages.MESSAGES.hpackFailed();
                      }
                      buffer.position(originalPos);
                      return;
                  }
                  String headerValue = readHpackString(buffer);
                  if (headerValue == null) {
                      if(!moreData) {
                          throw UndertowMessages.MESSAGES.hpackFailed();
                      }
                      buffer.position(originalPos);
                      return;
                  }
                  headerEmitter.emitHeader(headerName, headerValue, false);
              } else if ((b & 0b11110000) == 0b00010000) {
                  first = false;
                  //Literal Header Field never indexed
                  HttpString headerName = readHeaderName(buffer, 4);
                  if (headerName == null) {
                      buffer.position(originalPos);
                      return;
                  }
                  String headerValue = readHpackString(buffer);
                  if (headerValue == null) {
                      if(!moreData) {
                          throw UndertowMessages.MESSAGES.hpackFailed();
                      }
                      buffer.position(originalPos);
                      return;
                  }
                  headerEmitter.emitHeader(headerName, headerValue, true);
              } else if ((b & 0b11100000) == 0b00100000) {
                  if(!first) {
                      throw new HpackException();
                  }
                  //context update max table size change
                  if (!handleMaxMemorySizeChange(buffer, originalPos)) {
                      return;
                  }
              } else {
                  throw UndertowMessages.MESSAGES.invalidHpackEncoding(b);
              }
          }
          if(!moreData) {
              first = true;
          }
      }