code: public void serialize(RowPosition pos, DataOutputPlus out) throws IOException
          {
              Kind kind = pos.kind();
              out.writeByte(kind.ordinal());
              if (kind == Kind.ROW_KEY)
                  ByteBufferUtil.writeWithShortLength(((DecoratedKey)pos).getKey(), out);
              else
                  Token.serializer.serialize(pos.getToken(), out);
          }
docs: /*
  We need to be able to serialize both Token.KeyBound and
  DecoratedKey. To make this compact, we first write a byte whose
  meaning is:
  - 0: DecoratedKey
  - 1: a 'minimum' Token.KeyBound
  - 2: a 'maximum' Token.KeyBound
  In the case of the DecoratedKey, we then serialize the key (the
  token is recreated on the other side). In the other cases, we then
  serialize the token.