@Override
  public int compareTo(PdxString o) {
    // not handling strings with different headers
    if (header != o.header) {
      int diff = toString().compareTo(o.toString());
      return diff;
    }
    int len1 = getLength();
    int len2 = o.getLength();
    int n = Math.min(len1, len2);

    int i = offset;
    int j = o.offset;

    if (i == j) {
      int k = i;
      int lim = n + i;
      while (k < lim) {
        byte c1 = bytes[k];
        byte c2 = o.bytes[k];
        if (c1 != c2) {
          return c1 - c2;
        }
        k++;
      }
    } else {
      while (n-- != 0) {
        byte c1 = bytes[i++];
        byte c2 = o.bytes[j++];
        if (c1 != c2) {
          return c1 - c2;
        }
      }
    }
    return len1 - len2;
  }
A class that references the String offset in PdxInstance Used as Index keys for PdxInstances and
query evaluation for PdxInstances

@since GemFire 7.0
geode-core/src/main/java/org/apache/geode/pdx/internal/PdxString.java