Ejemplo n.º 1
0
  public int writeTokenValueBytes(LittleEndianOutput out) {

    out.writeByte(token_1_columns - 1);
    out.writeShort(token_2_rows - 1);
    ConstantValueParser.encode(out, token_3_arrayValues);
    return 3 + ConstantValueParser.getEncodedSize(token_3_arrayValues);
  }
Ejemplo n.º 2
0
  public void serialize(LittleEndianOutput out) {

    out.writeInt(0);
    out.writeInt(getFirstRow());
    out.writeInt(getLastRowAdd1());
    out.writeInt(field_4_zero);
    for (int k = 0; k < getNumDbcells(); k++) {
      out.writeInt(getDbcellAt(k));
    }
  }
Ejemplo n.º 3
0
 public void write(LittleEndianOutput out) {
   out.writeByte(sid + getPtgClass());
   out.writeByte(_options);
   out.writeShort(_data);
   int[] jt = _jumpTable;
   if (jt != null) {
     for (int i = 0; i < jt.length; i++) {
       out.writeShort(jt[i]);
     }
     out.writeShort(_chooseFuncOffset);
   }
 }
  @Override
  protected void serialize(LittleEndianOutput out) {

    out.writeShort(_sxaxis);
    out.writeShort(_cSub);
    out.writeShort(_grbitSub);
    out.writeShort(_cItm);

    if (_name != null) {
      StringUtil.writeUnicodeString(out, _name);
    } else {
      out.writeShort(STRING_NOT_PRESENT_LEN);
    }
  }
Ejemplo n.º 5
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);
    }
  }
Ejemplo n.º 6
0
  @Override
  protected void serializeValue(LittleEndianOutput out) {

    if (specialCachedValue == null) {
      out.writeDouble(field_4_value);
    } else {
      specialCachedValue.serialize(out);
    }

    out.writeShort(getOptions());

    out.writeInt(
        field_6_zero); // may as well write original data back so as to minimise differences from
                       // original
    field_8_parsed_expr.serialize(out);
  }
 public void serialize(LittleEndianOutput out) {
   int nItems = _list.size();
   out.writeShort(nItems);
   for (int k = 0; k < nItems; k++) {
     CellRangeAddress region = _list.get(k);
     region.serialize(out);
   }
 }
Ejemplo n.º 8
0
  public void serialize(LittleEndianOutput out) {
    int nItems = _list.size();

    out.writeShort(nItems);

    for (int i = 0; i < nItems; i++) {
      getRef(i).serialize(out);
    }
  }
Ejemplo n.º 9
0
 public void serializeTokens(LittleEndianOutput out) {
   out.write(_byteEncoding, 0, _encodedTokenLen);
 }
Ejemplo n.º 10
0
 /**
  * Writes The formula encoding is includes:
  *
  * <ul>
  *   <li>ushort tokenDataLen
  *   <li>tokenData
  *   <li>arrayConstantData (if present)
  * </ul>
  */
 public void serialize(LittleEndianOutput out) {
   out.writeShort(_encodedTokenLen);
   out.write(_byteEncoding);
 }
Ejemplo n.º 11
0
 public void serializeArrayConstantData(LittleEndianOutput out) {
   int len = _byteEncoding.length - _encodedTokenLen;
   out.write(_byteEncoding, _encodedTokenLen, len);
 }
Ejemplo n.º 12
0
 public void write(LittleEndianOutput out) {
   out.writeByte(sid + getPtgClass());
 }
Ejemplo n.º 13
0
  public void serialize(LittleEndianOutput out) {
    _range.serialize(out);

    _guid.serialize(out);
    out.writeInt(0x00000002); // TODO const
    out.writeInt(_linkOpts);

    if ((_linkOpts & HLINK_LABEL) != 0) {
      out.writeInt(_label.length());
      StringUtil.putUnicodeLE(_label, out);
    }
    if ((_linkOpts & HLINK_TARGET_FRAME) != 0) {
      out.writeInt(_targetFrame.length());
      StringUtil.putUnicodeLE(_targetFrame, out);
    }

    if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) != 0) {
      out.writeInt(_address.length());
      StringUtil.putUnicodeLE(_address, out);
    }

    if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) == 0) {
      _moniker.serialize(out);
      if (URL_MONIKER.equals(_moniker)) {
        if (_uninterpretedTail == null) {
          out.writeInt(_address.length() * 2);
          StringUtil.putUnicodeLE(_address, out);
        } else {
          out.writeInt(_address.length() * 2 + TAIL_SIZE);
          StringUtil.putUnicodeLE(_address, out);
          writeTail(_uninterpretedTail, out);
        }
      } else if (FILE_MONIKER.equals(_moniker)) {
        out.writeShort(_fileOpts);
        out.writeInt(_shortFilename.length());
        StringUtil.putCompressedUnicode(_shortFilename, out);
        writeTail(_uninterpretedTail, out);
        if (_address == null) {
          out.writeInt(0);
        } else {
          int addrLen = _address.length() * 2;
          out.writeInt(addrLen + 6);
          out.writeInt(addrLen);
          out.writeShort(0x0003); // TODO const
          StringUtil.putUnicodeLE(_address, out);
        }
      }
    }
    if ((_linkOpts & HLINK_PLACE) != 0) {
      out.writeInt(_textMark.length());
      StringUtil.putUnicodeLE(_textMark, out);
    }
  }
Ejemplo n.º 14
0
 public void serialize(LittleEndianOutput out) {
   out.writeShort(0);
 }
Ejemplo n.º 15
0
 public void serialize(LittleEndianOutput out) {
   out.writeShort(getBackup());
 }
 public void serialize(LittleEndianOutput out) {
   out.writeShort(getColWidth());
 }
 public void serialize(LittleEndianOutput out) {
   out.writeShort(sid);
   out.writeShort(reserved.length);
   out.write(reserved);
 }
Ejemplo n.º 18
0
 public void serialize(LittleEndianOutput out) {
   out.writeShort(_extBookIndex);
   out.writeShort(_firstSheetIndex);
   out.writeShort(_lastSheetIndex);
 }
Ejemplo n.º 19
0
 public void serialize(LittleEndianOutput out) {
   out.writeInt(_d1);
   out.writeShort(_d2);
   out.writeShort(_d3);
   out.writeLong(_d4);
 }
Ejemplo n.º 20
0
 private static void writeTail(byte[] tail, LittleEndianOutput out) {
   out.write(tail);
 }
  public void serialize(LittleEndianOutput out) {

    int formulaSize =
        field_2_refPtg == null ? field_2_unknownFormulaData.length : field_2_refPtg.getSize();
    int idOffset = getStreamIDOffset(formulaSize);
    int dataSize = getDataSize(idOffset);

    out.writeShort(sid);
    out.writeShort(dataSize);

    out.writeShort(idOffset);
    out.writeShort(formulaSize);
    out.writeInt(field_1_unknown_int);

    int pos = 12;

    if (field_2_refPtg == null) {
      out.write(field_2_unknownFormulaData);
    } else {
      field_2_refPtg.write(out);
    }
    pos += formulaSize;

    int stringLen;
    if (field_4_ole_classname == null) {
      // don't write 0x03, stringLen, flag, text
      stringLen = 0;
    } else {
      out.writeByte(0x03);
      pos += 1;
      stringLen = field_4_ole_classname.length();
      out.writeShort(stringLen);
      pos += 2;
      if (stringLen > 0) {
        out.writeByte(field_3_unicode_flag ? 0x01 : 0x00);
        pos += 1;

        if (field_3_unicode_flag) {
          StringUtil.putUnicodeLE(field_4_ole_classname, out);
          pos += stringLen * 2;
        } else {
          StringUtil.putCompressedUnicode(field_4_ole_classname, out);
          pos += stringLen;
        }
      }
    }

    // pad to next 2-byte boundary (requires 0 or 1 bytes)
    switch (idOffset - (pos - 6)) { // 6 for 3 shorts: sid, dataSize, idOffset
      case 1:
        out.writeByte(field_4_unknownByte == null ? 0x00 : field_4_unknownByte.intValue());
        pos++;
      case 0:
        break;
      default:
        throw new IllegalStateException("Bad padding calculation (" + idOffset + ", " + pos + ")");
    }

    if (field_5_stream_id != null) {
      out.writeInt(field_5_stream_id.intValue());
      pos += 4;
    }
    out.write(field_6_unknown);
  }
Ejemplo n.º 22
0
 public void write(LittleEndianOutput out) {
   out.writeByte(sid + getPtgClass());
   out.writeInt(field_1_reserved);
   out.writeShort(field_2_subex_len);
 }
Ejemplo n.º 23
0
 protected final void writeCoordinates(LittleEndianOutput out) {
   out.writeShort(field_1_first_row);
   out.writeShort(field_2_last_row);
   out.writeShort(field_3_first_column);
   out.writeShort(field_4_last_column);
 }
Ejemplo n.º 24
0
 public void serialize(LittleEndianOutput out) {
   out.writeShort(_character);
   out.writeShort(_fontIndex);
 }
Ejemplo n.º 25
0
 public void write(LittleEndianOutput out) {
   out.writeByte(sid + getPtgClass());
   out.write(field_1_reserved);
 }
Ejemplo n.º 26
0
 public void serialize(LittleEndianOutput out) {
   out.write(_variableData);
   out.writeShort(0xFFFF);
 }
Ejemplo n.º 27
0
 public void write(LittleEndianOutput out) {
   out.writeByte(sid + getPtgClass());
   out.writeDouble(getValue());
 }
Ejemplo n.º 28
0
 public void write(LittleEndianOutput out) {
   out.writeByte(sid + getPtgClass());
   out.writeShort(field_1_index_extern_sheet);
   out.writeInt(unused1);
 }