Package net.sf.joafip.store.entity.objectio.serialize

Examples of net.sf.joafip.store.entity.objectio.serialize.WriteResult


    final ClassInfo classInfo = classInfoFactory
        .getNoProxyClassInfo(toSerialize.getClass());
    Object[] referenceds = toSerializeAndReferenced.getReferenceds();

    // initial write
    WriteResult writeResult = write(toSerialize, classInfo);
    ObjectClassInfoAndDeclared[] sons = writeResult.getSons();
    ObjectAndPersistInfo objectAndPersistInfo = writeResult
        .getObjectAndPersistInfo();
    final byte[] binary = writeResult.getBinary();

    // check sons wrote
    assertSons(toSerialize, sons, referenceds);
    ObjectClassInfoAndDeclared[] originalValue = objectAndPersistInfo.originalValue;
    assertSons(toSerialize, originalValue, referenceds);
    // dummy data record identifier for object
    final DataRecordIdentifier dataRecordIdentifier =
    /**/getOrCreateDataRecordIdentifierAssociatedToObject(objectAndPersistInfo);

    // create the object by reading
    final IObjectInput objectInput = new ObjectInputImmediateSerializable(
        this, classInfoFactory, proxyManager2, helperBinaryConversion);

    final StorageInfo storageInfo = new StorageInfo();
    // storageInfo.setHeaderDataSize(0);
    ObjectAndPersistInfo unserializedAndPersistInfo = objectInput
        .createObject(dataRecordIdentifier, binary, classInfo,
            storageInfo);
    originalValue = unserializedAndPersistInfo.originalValue;
    assertSons(toSerialize, originalValue, referenceds);
    final Object unserialized = unserializedAndPersistInfo.getObject();
    if (testEquals) {
      assertEquals("read and wrote must have the same value",
          toSerialize, unserialized);
    }
    assertUnserialized(unserialized);

    // check modification
    referenceds = modifyObjectToSerialize(unserialized);
    // write
    writeResult = write(unserialized, classInfo);
    sons = writeResult.getSons();
    unserializedAndPersistInfo = writeResult.getObjectAndPersistInfo();
    // check sons wrote
    assertSons(toSerialize, sons, referenceds);
    originalValue = unserializedAndPersistInfo.originalValue;
    assertSons(toSerialize, originalValue, referenceds);

    // modify wrote object
    referenceds = modifyObjectToSerialize(toSerialize);
    // write modification
    writeResult = write(toSerialize, classInfo);
    sons = writeResult.getSons();
    objectAndPersistInfo = writeResult.getObjectAndPersistInfo();
    // check sons wrote
    assertSons(toSerialize, sons, referenceds);
    originalValue = objectAndPersistInfo.originalValue;
    assertSons(toSerialize, originalValue, referenceds);

View Full Code Here


        .byteSize(objectAndPersistInfo, offset);
    final byte[] binary = new byte[byteSize];
    // write
    final ObjectClassInfoAndDeclared[] sons = objectOutput
        .writeBody(binary, offset, objectAndPersistInfo, true/* updateOriginalValue */);
    return new WriteResult(objectAndPersistInfo, sons, binary);
  }
View Full Code Here

TOP

Related Classes of net.sf.joafip.store.entity.objectio.serialize.WriteResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.