Examples of AbstractConverter


Examples of net.sf.joafip.store.service.binary.AbstractConverter

    final int numberRead = changeFileInputStream.read(data);
    if (numberRead == -1) {
      haveRead = false;
    } else if (numberRead == data.length) {

      AbstractConverter binaryConverter;
      try {
        binaryConverter = helperBinaryConversion.longConverter;
        binaryConverter.fromBinary(data, 0);
      } catch (final BinaryConverterException exception) {
        throw new ObjectIOException(exception);
      }
      if (!binaryConverter.valueDefinedFromBinary) {
        throw new ObjectIOException(
            "data record identifier value must be defined");
      }
      final Long dataRecordIdentifierValue =
      /**/(Long) binaryConverter.objectFromBinary;
      binaryConverter.objectFromBinary = null;// NOPMD
      final DataRecordIdentifier dataRecordIdentifier =
      /**/new DataRecordIdentifier(dataRecordIdentifierValue);

      /* second get data for object length */
      data = new byte[HelperBinaryConversion.INT_BYTE_SIZE];
      readInChangeFileInputStream(changeFileInputStream, data);
      try {
        binaryConverter = helperBinaryConversion.integerConverter;
        binaryConverter.fromBinary(data, 0);
      } catch (final BinaryConverterException exception) {
        throw new ObjectIOException(exception);
      }
      if (!binaryConverter.valueDefinedFromBinary) {
        throw new ObjectIOException("data length value must be defined");
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

  public void read(final byte[] binary,
      final DataRecordIdentifier dataRecordIdentifier)
      throws ObjectIOException, ObjectIOClassNotFoundException {
    int offset = 0;
    AbstractConverter binaryConverter;

    /*
     * first data is class name identifier and flag
     */
    try {
      binaryConverter = helperBinaryConversion.integerConverter;
      binaryConverter.fromBinary(binary, offset);
    } catch (BinaryConverterException exception) {
      throw new ObjectIOException(FOR_DATA_RECORD + dataRecordIdentifier,
          exception);
    }
    if (!binaryConverter.valueDefinedFromBinary) {
      throw new ObjectIOException(
          "class name identifier value must be defined for data record "
              + dataRecordIdentifier);
    }
    offset += HelperBinaryConversion.INT_BYTE_SIZE;
    final int classNameIdentifierAndFormatFlag = ((Integer) binaryConverter.objectFromBinary)
        .intValue();
    binaryConverter.objectFromBinary = null;// NOPMD

    extendedDatarecordFormat = (classNameIdentifierAndFormatFlag & 0x80000000) == 0x80000000;
    if (extendedDatarecordFormat) {

      /*
       * record format identifier
       */
      try {
        binaryConverter = helperBinaryConversion.shortConverter;
        binaryConverter.fromBinary(binary, offset);
      } catch (BinaryConverterException exception) {
        throw new ObjectIOException(FOR_DATA_RECORD
            + dataRecordIdentifier, exception);
      }
      offset += HelperBinaryConversion.SHORT_BYTE_SIZE;
      if (!binaryConverter.valueDefinedFromBinary) {
        throw new ObjectIOException(
            "record format identifier value must be defined for data record "
                + dataRecordIdentifier);
      }
      recordFormatId = ((Short) binaryConverter.objectFromBinary)
          .shortValue();
      binaryConverter.objectFromBinary = null;// NOPMD

      /*
       * joafip release id
       */
      try {
        binaryConverter = helperBinaryConversion.integerConverter;
        binaryConverter.fromBinary(binary, offset);
      } catch (BinaryConverterException exception) {
        throw new ObjectIOException(FOR_DATA_RECORD
            + dataRecordIdentifier, exception);
      }
      if (!binaryConverter.valueDefinedFromBinary) {
        throw new ObjectIOException(
            "joafip release id value must be defined for data record "
                + dataRecordIdentifier);
      }
      offset += HelperBinaryConversion.INT_BYTE_SIZE;
      joafipReleaseId = ((Integer) binaryConverter.objectFromBinary)
          .intValue();
      binaryConverter.objectFromBinary = null;// NOPMD

      /*
       * data model identifier
       */

      try {
        binaryConverter = helperBinaryConversion.integerConverter;
        binaryConverter.fromBinary(binary, offset);
      } catch (BinaryConverterException exception) {
        throw new ObjectIOException(FOR_DATA_RECORD
            + dataRecordIdentifier, exception);
      }
      if (!binaryConverter.valueDefinedFromBinary) {
        throw new ObjectIOException(
            "data model identifier value must be defined for data record "
                + dataRecordIdentifier);
      }
      offset += HelperBinaryConversion.INT_BYTE_SIZE;
      dataModelIdentifier = ((Integer) binaryConverter.objectFromBinary)
          .intValue();
      binaryConverter.objectFromBinary = null;// NOPMD

      /*
       * flags
       */
      if (recordFormatId == RecordFormatIdentifier.ID_FOR_3_0_1_THRU_3_1_0) {

        try {
          binaryConverter = helperBinaryConversion.byteConverter;
          binaryConverter.fromBinary(binary, offset);
        } catch (BinaryConverterException exception) {
          throw new ObjectIOException(FOR_DATA_RECORD
              + dataRecordIdentifier, exception);
        }
        if (!binaryConverter.valueDefinedFromBinary) {
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

    }
    try {
      if (fieldInfo.isPersisted()) {
        if (fieldType.isPrimitiveType()) {
          /* a primitive field */
          AbstractConverter binaryConverter;
          binaryConverter = (AbstractConverter) helperBinaryConversion
              .fromBinary(binary, offset, fieldType);
          if (!binaryConverter.valueDefinedFromBinary) {
            throw new ObjectIOException(
                "field value must be defined");
          }
          final Object fieldValue = binaryConverter.objectFromBinary;
          binaryConverter.objectFromBinary = null;// NOPMD
          /* primitive not persisted */
          fieldValueAndPersistInfo = objectIOManager
              .getOrCreateObjectPersistInfoOfObject(fieldValue,
                  false, fieldType, Boolean.FALSE);
          // offset += helperBinaryConversion.byteSize(type);
          offset += fieldType.getBinarySize();
        } else if (helperBinaryConversion.getType(binary, offset) ==
        /*       */HelperBinaryConversion.REFERENCE_TYPE) {
          /* a reference field */
          fieldValueAndPersistInfo = referenceInput.fromBinary(
              binary, offset);
          offset += HelperBinaryConversion.REFERENCE_NULLABLE_BYTE_SIZE;
          if (!fieldValueAndPersistInfo.valueDefined) {
            throw new ObjectIOException(
                "field value must be defined");
          }
        } else {
          /* a basic field */
          AbstractConverter binaryConverter;
          try {
            binaryConverter = (AbstractConverter) helperBinaryConversion
                .fromBinary(binary, offset);
          } catch (BinaryConverterException exception) {
            throw new ObjectIOException(exception);
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

    if (logger.debugEnabled) {
      logger.debug("read field at offset " + offset);
    }
    if (fieldInfo.isPersisted()) {
      if (fieldType.isBasicOrPrimitiveType()) {
        AbstractConverter binaryConverter;
        try {
          binaryConverter = helperBinaryConversion.fromBinary(binary,
              offset, fieldType);
        } catch (BinaryConverterException exception) {
          throw new ObjectIOException(exception);
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

  }

  @Override
  public int read() throws IOException {
    final int byteValue;
    AbstractConverter binaryConverter;
    try {
      binaryConverter = helperBinaryConversion.byteConverter;
      binaryConverter.fromBinary(binary, offset);
    } catch (BinaryConverterException exception) {
      throw new IOException(exception);
    }
    if (!binaryConverter.valueDefinedFromBinary) {
      throw new IOException(VALUE_NOT_DEFINED);
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

  }

  @Override
  public boolean readBoolean() throws IOException {
    final boolean value;
    AbstractConverter binaryConverter;
    try {
      binaryConverter = helperBinaryConversion.booleanConverter;
      binaryConverter.fromBinary(binary, offset);
    } catch (BinaryConverterException exception) {
      throw new IOException(exception);
    }
    if (!binaryConverter.valueDefinedFromBinary) {
      throw new IOException(VALUE_NOT_DEFINED);
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

  }

  @Override
  public byte readByte() throws IOException {
    final byte value;
    AbstractConverter binaryConverter;
    try {
      binaryConverter = helperBinaryConversion.byteConverter;
      binaryConverter.fromBinary(binary, offset);
    } catch (BinaryConverterException exception) {
      throw new IOException(exception);
    }
    if (!binaryConverter.valueDefinedFromBinary) {
      throw new IOException(VALUE_NOT_DEFINED);
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

  }

  @Override
  public int readUnsignedByte() throws IOException {
    final int byteValue;
    AbstractConverter binaryConverter;
    try {
      binaryConverter = helperBinaryConversion.byteConverter;
      binaryConverter.fromBinary(binary, offset);
    } catch (BinaryConverterException exception) {
      throw new IOException(exception);
    }
    if (!binaryConverter.valueDefinedFromBinary) {
      throw new IOException(VALUE_NOT_DEFINED);
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

  }

  @Override
  public char readChar() throws IOException {
    final char value;
    AbstractConverter binaryConverter;
    try {
      binaryConverter = helperBinaryConversion.characterConverter;
      binaryConverter.fromBinary(binary, offset);
    } catch (BinaryConverterException exception) {
      throw new IOException(exception);
    }
    if (!binaryConverter.valueDefinedFromBinary) {
      throw new IOException(VALUE_NOT_DEFINED);
View Full Code Here

Examples of net.sf.joafip.store.service.binary.AbstractConverter

  }

  @Override
  public short readShort() throws IOException {
    final short value;
    final AbstractConverter binaryConverter;
    try {
      binaryConverter = helperBinaryConversion.shortConverter;
      binaryConverter.fromBinary(binary, offset);
    } catch (BinaryConverterException exception) {
      throw new IOException(exception);
    }
    if (!binaryConverter.valueDefinedFromBinary) {
      throw new IOException(VALUE_NOT_DEFINED);
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.