private static void encodeSingleValue(LittleEndianOutput out, Object value) {
    if (value == EMPTY_REPRESENTATION) {
      out.writeByte(TYPE_EMPTY);
      out.writeLong(0L);
      return;
    }
    if (value instanceof Boolean) {
      Boolean bVal = ((Boolean) value);
      out.writeByte(TYPE_BOOLEAN);
      long longVal = bVal.booleanValue() ? 1L : 0L;
      out.writeLong(longVal);
      return;
    }
    if (value instanceof Double) {
      Double dVal = (Double) value;
      out.writeByte(TYPE_NUMBER);
      out.writeDouble(dVal.doubleValue());
      return;
    }
    if (value instanceof String) {
      String val = (String) value;
      out.writeByte(TYPE_STRING);
      StringUtil.writeUnicodeString(out, val);
      return;
    }
    if (value instanceof ErrorConstant) {
      ErrorConstant ecVal = (ErrorConstant) value;
      out.writeByte(TYPE_ERROR_CODE);
      long longVal = ecVal.getErrorCode();
      out.writeLong(longVal);
      return;
    }

    throw new IllegalStateException("Unexpected value type (" + value.getClass().getName() + "'");
  }
예제 #2
0
  public void serialize(LittleEndianOutput out) {
    out.writeShort(field_1_number_of_sheets);

    if (isExternalReferences()) {
      StringUtil.writeUnicodeString(out, field_2_encoded_url);

      for (int i = 0; i < field_3_sheet_names.length; i++) {
        StringUtil.writeUnicodeString(out, field_3_sheet_names[i]);
      }
    } else {
      int field2val = _isAddInFunctions ? TAG_ADD_IN_FUNCTIONS : TAG_INTERNAL_REFERENCES;

      out.writeShort(field2val);
    }
  }
 public void serialize(LittleEndianOutput out) {
   out.writeShort(field_1_minimumCategory);
   out.writeShort(field_2_maximumCategory);
   out.writeShort(field_3_majorUnitValue);
   out.writeShort(field_4_majorUnit);
   out.writeShort(field_5_minorUnitValue);
   out.writeShort(field_6_minorUnit);
   out.writeShort(field_7_baseUnit);
   out.writeShort(field_8_crossingPoint);
   out.writeShort(field_9_options);
 }
예제 #4
0
 public void serialize(LittleEndianOutput out) {
   out.writeShort(getVersion());
   out.writeShort(getType());
   out.writeShort(getBuild());
   out.writeShort(getBuildYear());
   out.writeInt(getHistoryBitMask());
   out.writeInt(getRequiredVersion());
 }
  @Override
  protected void serialize(LittleEndianOutput out) {

    out.writeInt(_grbit1);
    out.writeByte(_grbit2);
    out.writeByte(_citmShow);
    out.writeShort(_isxdiSort);
    out.writeShort(_isxdiShow);

    if (_subtotalName == null) {
      out.writeShort(STRING_NOT_PRESENT_LEN);
    } else {
      out.writeShort(_subtotalName.length());
    }

    out.writeInt(_reserved1);
    out.writeInt(_reserved2);
    if (_subtotalName != null) {
      StringUtil.putUnicodeLE(_subtotalName, out);
    }
  }
예제 #6
0
 public void serialize(LittleEndianOutput out) {
   out.writeInt(errorCheck);
 }
 public void write(LittleEndianOutput out) {
   out.writeByte(sid + getPtgClass());
   out.writeShort(field_1_index_extern_sheet);
   out.writeInt(unused1);
   out.writeInt(unused2);
 }
예제 #8
0
 /** spit the record out AS IS. no interpretation or identification */
 public void serialize(LittleEndianOutput out) {
   out.write(_rawData);
 }
예제 #9
0
 protected void serializeExtraData(LittleEndianOutput out) {
   out.writeShort(_options);
   out.writeInt(_field3notUsed);
   _formula.serialize(out);
 }
예제 #10
0
 public void serialize(LittleEndianOutput out) {
   out.writeShort(_character);
   out.writeShort(_fontIndex);
 }
 public void serialize(LittleEndianOutput out) {
   out.writeShort(field_1_flags);
   out.writeShort(field_2_empty);
 }