public String toString() {
    String s = null;
    int headerOffset = offset;
    try {
      --headerOffset; // for header byte
      if (header == DSCODE.STRING_BYTES.toByte() || header == DSCODE.STRING.toByte()) {
        headerOffset -= 2; // position the offset to the start of the String (skipping
        // header and length bytes)
      }
      // length is stored as int for huge strings
      else if (header == DSCODE.HUGE_STRING_BYTES.toByte()
          || header == DSCODE.HUGE_STRING.toByte()) {
        headerOffset -= 4;
      }
      ByteBuffer stringByteBuffer =
          ByteBuffer.wrap(bytes, headerOffset, bytes.length - headerOffset); // Wrapping more bytes
                                                                             // than the actual
                                                                             // String bytes in
      // array. Counting on the readString() to read only String
      // bytes
      try (ByteBufferInputStream byteBufferInputStream =
          new ByteBufferInputStream(stringByteBuffer)) {
        s = DataSerializer.readString(byteBufferInputStream);
      }
    } catch (IOException e) {
      throw new IllegalStateException(e);
    }
    return s;
  }
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