Examples of IObjectOutput


Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

    final StorageInfo storageInfo = new StorageInfo();
    final int offset = storageInfo.getHeaderDataSize();
    final ObjectAndPersistInfo objectAndPersistInfo =
    /**/new ObjectAndPersistInfo(toSerialize, false, classInfo,
        storageInfo);
    final IObjectOutput objectOutput = new ObjectOutputSerializable(this,
        classInfoFactory, proxyManager2, helperBinaryConversion);
    // prepare write
    objectOutput.prepareWrite(objectAndPersistInfo);
    assertTrue("must have value changed since a new object",
        objectOutput.isValueChanged(objectAndPersistInfo));
    assertNull("for initial write must not have original value",
        objectAndPersistInfo.originalValue);
    // storageInfo.setHeaderDataSize(offset);
    final int byteSize = objectOutput
        .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

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

  public void testInteger() throws ObjectIOException,
      ObjectIOInvalidClassException, ObjectIONotSerializableException,
      ObjectIODataRecordNotFoundException,
      ObjectIOClassNotFoundException, ObjectIODataCorruptedException,
      ClassInfoException, ObjectIOTooBigForSerializationException {
    final IObjectOutput objectOutput = new ObjectOutputForBasic(this,
        classInfoFactory, proxyManager2, helperBinaryConversion);
    final ClassInfo classInfo = classInfoFactory
        .getNoProxyClassInfo(Integer.class);
    final Integer integer = Integer.valueOf(10);
    final StorageInfo storageInfo = new StorageInfo();
    final ObjectAndPersistInfo objectAndItsClassInfo =
    /**/new ObjectAndPersistInfo(integer, false, classInfo, storageInfo);
    objectOutput.prepareWrite(objectAndItsClassInfo);
    final byte[] binary = new byte[1000];
    final int offset = storageInfo.getHeaderDataSize();
    storageInfo.setHeaderDataSize(offset);
    // int byte size to skip class name information
    objectOutput
        .writeBody(binary, offset/*
                     * bodyBeginOffset for class id
                     */, objectAndItsClassInfo, false/* updateOriginalValue */);
    // dummy data record identifier for object
    final DataRecordIdentifier dataRecordIdentifier = DataRecordIdentifier.LAST;
View Full Code Here

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

    /**/objectAndPersistInfo.getSubstituteObjectAndPersistInfo();
    if (toWriteObjectAndItsClassInfo == null) {
      toWriteObjectAndItsClassInfo = objectAndPersistInfo;
    }
    final ClassInfo classInfo = toWriteObjectAndItsClassInfo.objectClassInfo;
    final IObjectOutput objectOutput;
    objectOutput = getObjectOutput(classInfo);
    assert !toWriteObjectAndItsClassInfo.isSubstituted();
    return objectOutput.willNotBeWrote(toWriteObjectAndItsClassInfo);
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

    if (toWriteObjectAndItsClassInfo == null) {
      toWriteObjectAndItsClassInfo = objectAndPersistInfo;
    }
    final boolean valueChanged;
    final ClassInfo classInfo = toWriteObjectAndItsClassInfo.objectClassInfo;
    final IObjectOutput objectOutput;
    objectOutput = getObjectOutput(classInfo);
    assert !toWriteObjectAndItsClassInfo.isSubstituted();
    if (toWriteObjectAndItsClassInfo.newObject) {
      if (garbageManagement) {
        objectOutput
            .setReferenceChangeListForNewObject(toWriteObjectAndItsClassInfo);
      }
      valueChanged = true;
    } else {
      valueChanged = objectOutput
          .isValueChanged(toWriteObjectAndItsClassInfo);
    }
    return valueChanged;
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

    if (logger.debugEnabled) {
      logger.debug("begin store: data record " + dataRecordIdentifier);
    }

    /* the object class can be different than object.getClass() */
    final IObjectOutput objectOutput;
    objectOutput = getObjectOutput(classInfo);
    assert !toWrite.isSubstituted();
    objectOutput.prepareWrite(toWrite);

    final int byteSizeForObject = objectOutput.byteSize(toWrite,
        HEADER_DATA_SIZE);
    /*
     * "long byte size" added to length for object and store data record
     * identifier
     */

    final byte[] binary = new byte[HelperBinaryConversion.INT_BYTE_SIZE
        + HelperBinaryConversion.LONG_BYTE_SIZE + byteSizeForObject];

    int offset = 0;
    try {
      /* first data is data record identifier */
      offset = helperBinaryConversion.longConverter.toBinary(binary,
          offset, true, dataRecordIdentifier.value);

      /* second is data for object length */
      offset = helperBinaryConversion.integerConverter.toBinary(binary,
          offset, true, byteSizeForObject);

      /* third data is class name identifier */
      final int classNameIdentifier = classNameManager
          .getIdentifier(classInfo);
      /* the data header */
      offset = helperBinaryConversion.integerConverter.toBinary(binary,
          offset, true, Integer.valueOf(classNameIdentifier));
    } catch (final BinaryConverterException exception) {
      throw new ObjectIOException(exception);
    }

    if (offset != HEADER_DATA_SIZE) {
      throw new ObjectIOException("header data size miss match");
    }

    /* then object serialization */
    objectOutput.writeBody(binary, offset, toWrite, false);

    try {
      changeFileOutputStream.write(binary, 0, binary.length);
    } catch (final IOException exception) {
      throw new ObjectIOException(exception);
View Full Code Here

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

    objectInputBasic = new ObjectInputForBasic(this, classInfoFactory,
        proxyManager2, helperBinaryConversion);
    objectInputs[EnumObjectInput.OBJECT_INPUT_BASIC.ordinal()] =
    /**/objectInputBasic;

    final IObjectOutput objectOutputBasic;
    objectOutputBasic = new ObjectOutputForBasic(this, classInfoFactory,
        proxyManager2, helperBinaryConversion);
    objectOutputs[EnumObjectOutput.OBJECT_OUTPUT_BASIC.ordinal()] =
    /**/objectOutputBasic;

    objectInputEnum = new ObjectInputForEnum(this, classInfoFactory,
        proxyManager2, helperBinaryConversion);
    objectInputs[EnumObjectInput.OBJECT_INPUT_ENUM.ordinal()] =
    /**/objectInputEnum;

    final IObjectOutput objectOutputEnum;
    objectOutputEnum = new ObjectOutputForEnum(this, classInfoFactory,
        proxyManager2, helperBinaryConversion);
    objectOutputs[EnumObjectOutput.OBJECT_OUTPUT_ENUM.ordinal()] =
    /**/objectOutputEnum;

    final IObjectInput objectInputSerialize;
    objectInputSerialize = new ObjectInputSerialize(this, classInfoFactory,
        proxyManager2, helperBinaryConversion);
    objectInputs[EnumObjectInput.OBJECT_INPUT_SERIALIZE.ordinal()] =
    /**/objectInputSerialize;

    final IObjectOutput objectOutputSerialize;
    objectOutputSerialize = new ObjectOutputSerialize(this,
        classInfoFactory, proxyManager2, helperBinaryConversion);
    objectOutputs[EnumObjectOutput.OBJECT_OUTPUT_SERIALIZE.ordinal()] =
    /**/objectOutputSerialize;

    final IObjectInput objectInputSerializeZipped;
    objectInputSerializeZipped = new ObjectInputSerializeZipped(this,
        classInfoFactory, proxyManager2, helperBinaryConversion);
    objectInputs[EnumObjectInput.OBJECT_INPUT_SERIALIZE_ZIPPED.ordinal()] =
    /**/objectInputSerializeZipped;

    final IObjectOutput objectOutputSerializeZipped;
    objectOutputSerializeZipped = new ObjectOutputSerializeZipped(this,
        classInfoFactory, proxyManager2, helperBinaryConversion);
    objectOutputs[EnumObjectOutput.OBJECT_OUTPUT_SERIALIZE_ZIPPED.ordinal()] =
    /**/objectOutputSerializeZipped;

    final IObjectInput objectInputSerializeGZipped;
    objectInputSerializeGZipped = new ObjectInputSerializeGZipped(this,
        classInfoFactory, proxyManager2, helperBinaryConversion);
    objectInputs[EnumObjectInput.OBJECT_INPUT_SERIALIZE_GZIPPED.ordinal()] =
    /**/objectInputSerializeGZipped;

    final IObjectOutput objectOutputSerializeGZipped;
    objectOutputSerializeGZipped = new ObjectOutputSerializeGZipped(this,
        classInfoFactory, proxyManager2, helperBinaryConversion);
    objectOutputs[EnumObjectOutput.OBJECT_OUTPUT_SERIALIZE_GZIPPED
        .ordinal()] =
    /**/objectOutputSerializeGZipped;
 
View Full Code Here

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

   * @return the object output manager according to object class
   * @throws ObjectIOException
   */
  protected IObjectOutput getObjectOutput(final ClassInfo classInfo)
      throws ObjectIOException {
    IObjectOutput objectOutput;
    if (classInfo.isUseSpecificObjectIO()) {
      objectOutput = specificObjectOutputMap.get(classInfo);
    } else {
      final EnumObjectOutput enumObjectOutput;
      try {
View Full Code Here

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

    /* the object class can be different than object.getClass() */
    final ClassInfo classInfo = toWriteObjectAndPersistInfo.objectClassInfo;
    // ASSERTX
    assert classInfo != null && classInfo != ClassInfo.NULL : "class information for object not defined";
    final IObjectOutput objectOutput;
    objectOutput = getObjectOutput(classInfo);
    final int byteSize = objectOutput.byteSize(toWriteObjectAndPersistInfo,
        HEADER_DATA_SIZE);
    final byte[] binary = new byte[byteSize];
    final int offset = headerWriter.write(classInfo, binary);
    if (offset != HEADER_DATA_SIZE) {
      throw new ObjectIOException("header data size missmatch");
    }
    final ObjectClassInfoAndDeclared[] sonObject = objectOutput.writeBody(
        binary, offset, toWriteObjectAndPersistInfo, true);

    writeDataRecord(dataRecordIdentifier, binary);

    if (logger.debugEnabled) {
View Full Code Here

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

      }
    }
    final ClassInfo toWriteClassInfo = toWriteObjectAndPersistInfo.objectClassInfo;
    assert assertWritable(toWriteObjectAndPersistInfo);
    final Object object = toWriteObjectAndPersistInfo.getObject();
    final IObjectOutput objectOutput;
    // ASSERTX
    assert assertHasInstance(toWriteObjectAndPersistInfo, object);
    objectOutput = getObjectOutput(toWriteClassInfo);
    assert !toWriteClassInfo.isSubstituted();
    objectOutput.prepareWrite(toWriteObjectAndPersistInfo);
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput

    synchronized (mutex) {
      try {
        final ClassInfo classInfo = classInfoFactory
            .getNoProxyClassInfo(objectClass);
        final IObjectInput objectInput = createObjectInput(objectInputClass);
        final IObjectOutput objectOutput = createObjectOutput(objectOutputClass);
        objectIOManager.setSpecificObjectIO(classInfo, objectInput,
            objectOutput);
      } catch (final Exception exception) {
        throw new StoreException(exception);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.