public static PdxInstance readPdxInstance(final byte[] dataBytes, InternalCache internalCache) {
    try {
      byte type = dataBytes[0];
      if (type == DSCODE.PDX.toByte()) {
        PdxInputStream in = new PdxInputStream(dataBytes);
        in.readByte(); // throw away the type byte
        int len = in.readInt();
        int typeId = in.readInt();
        PdxType pdxType = internalCache.getPdxRegistry().getType(typeId);
        if (pdxType == null) {
          throw new IllegalStateException("Unknown pdx type=" + typeId);
        }

        return new PdxInstanceImpl(pdxType, in, len);
      } else if (type == DSCODE.PDX_ENUM.toByte()) {
        try (PdxInputStream in = new PdxInputStream(dataBytes)) {
          in.readByte(); // throw away the type byte
          int dsId = in.readByte();
          int tmp = readArrayLength(in);
          int enumId = dsId << 24 | tmp & 0xFFFFFF;
          TypeRegistry tr = internalCache.getPdxRegistry();
          EnumInfo ei = tr.getEnumInfoById(enumId);
          if (ei == null) {
            throw new IllegalStateException("Unknown pdx enum id=" + enumId);
          }
          return ei.getPdxInstance(enumId);
        }
      } else if (type == DSCODE.PDX_INLINE_ENUM.toByte()) {
        try (PdxInputStream in = new PdxInputStream(dataBytes)) {
          in.readByte(); // throw away the type byte
          String className = DataSerializer.readString(in);
          String enumName = DataSerializer.readString(in);
          int enumOrdinal = InternalDataSerializer.readArrayLength(in);
          return new PdxInstanceEnum(className, enumName, enumOrdinal);
        }
      }
    } catch (IOException ignore) {
    }
    return null;
  }
Reads a PdxInstance from dataBytes and returns it. If the first object read is not pdx encoded
returns null.
geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java