Пример #1
0
    public Map<OIdentifiable, Change> deserializeChanges(final byte[] stream, int offset) {
      final int count = OIntegerSerializer.INSTANCE.deserializeLiteral(stream, offset);
      offset += OIntegerSerializer.INT_SIZE;

      final HashMap<OIdentifiable, Change> res = new HashMap<OIdentifiable, Change>();
      for (int i = 0; i < count; i++) {
        ORecordId rid = OLinkSerializer.INSTANCE.deserialize(stream, offset);
        offset += OLinkSerializer.RID_SIZE;
        Change change = ChangeSerializationHelper.INSTANCE.deserializeChange(stream, offset);
        offset += Change.SIZE;

        final OIdentifiable identifiable;
        if (rid.isTemporary() && rid.getRecord() != null) identifiable = rid.getRecord();
        else identifiable = rid;

        res.put(identifiable, change);
      }

      return res;
    }
Пример #2
0
  private void doDeserialization() {
    if (deserialized) return;

    int offset = 0;
    int entriesSize = OIntegerSerializer.INSTANCE.deserialize(serializedContent, offset);
    offset += OIntegerSerializer.INT_SIZE;

    for (int i = 0; i < entriesSize; i++) {
      ORID rid = OLinkSerializer.INSTANCE.deserialize(serializedContent, offset);
      offset += OLinkSerializer.RID_SIZE;

      OIdentifiable identifiable;
      if (rid.isTemporary()) identifiable = rid.getRecord();
      else identifiable = rid;

      addEntry(identifiable);
    }

    deserialized = true;
  }