Beispiel #1
0
 protected void fillFields(byte[] data, int offset) {
   field_1_iStartAt = LittleEndian.getInt(data, 0x0 + offset);
   field_2_nfc = data[0x4 + offset];
   field_3_info = data[0x5 + offset];
   field_4_rgbxchNums = LittleEndian.getByteArray(data, 0x6 + offset, 9);
   field_5_ixchFollow = data[0xf + offset];
   field_6_dxaIndentSav = LittleEndian.getInt(data, 0x10 + offset);
   field_7_unused2 = LittleEndian.getInt(data, 0x14 + offset);
   field_8_cbGrpprlChpx = LittleEndian.getUByte(data, 0x18 + offset);
   field_9_cbGrpprlPapx = LittleEndian.getUByte(data, 0x19 + offset);
   field_10_ilvlRestartLim = LittleEndian.getUByte(data, 0x1a + offset);
   field_11_grfhic = new Grfhic(data, 0x1b + offset);
 }
Beispiel #2
0
  static Sttb read(int cDataLength, byte[] buffer, int startOffset) {
    short ffff = LittleEndian.getShort(buffer, startOffset);
    int offset = startOffset + 2;

    if (ffff != (short) 0xffff) {
      // Non-extended character Pascal strings
      throw new UnsupportedOperationException(
          "Non-extended character Pascal strings are not supported right now. "
              + "Please, contact POI developers for update.");
    }
    // strings are extended character strings

    int cData =
        cDataLength == 2
            ? LittleEndian.getUShort(buffer, offset)
            : LittleEndian.getInt(buffer, offset);
    offset += cDataLength;

    Sttb sttb = new Sttb();
    sttb.cDataLength = cDataLength;
    sttb.cbExtra = LittleEndian.getUShort(buffer, offset);
    offset += 2;

    sttb.data = new String[cData];
    sttb.extraData = new byte[cData][];

    for (int i = 0; i < cData; i++) {
      int cchData = LittleEndian.getShort(buffer, offset);
      offset += 2;

      if (cchData < 0) continue;

      sttb.data[i] = StringUtil.getFromUnicodeLE(buffer, offset, cchData);
      offset += cchData * 2;

      sttb.extraData[i] = LittleEndian.getByteArray(buffer, offset, sttb.cbExtra);
      offset += sttb.cbExtra;
    }

    return sttb;
  }