docs: @Override
      public Step.Result decode(ByteBuffer data, int size, ValueReference<Integer> processed)
      {
          processed.set(0);
  
          //  In case of zero-copy simply adjust the pointers, no copying
          //  is required. Also, run the state machine in case all the data
          //  were processed.
          if (zeroCopy) {
              assert (size <= toRead);
              readPos.position(readPos.position() + size);
              toRead -= size;
              processed.set(size);
  
              while (readPos.remaining() == 0) {
                  Step.Result result = next.apply();
                  if (result != Step.Result.MORE_DATA) {
                      return result;
                  }
              }
              return Step.Result.MORE_DATA;
          }
  
          while (processed.get() < size) {
              //  Copy the data from buffer to the message.
              int toCopy = Math.min(toRead, size - processed.get());
              int limit = data.limit();
              data.limit(data.position() + toCopy);
              readPos.put(data);
              data.limit(limit);
              toRead -= toCopy;
              processed.set(processed.get() + toCopy);
  
              //  Try to get more space in the message to fill in.
              //  If none is available, return.
              while (readPos.remaining() == 0) {
                  Step.Result result = next.apply();
                  if (result != Step.Result.MORE_DATA) {
                      return result;
                  }
              }
          }
  
          return Step.Result.MORE_DATA;
      }