/** @param in the RecordInputstream to read the record from */ public LabelRecord(RecordInputStream in) { field_1_row = in.readUShort(); field_2_column = in.readShort(); field_3_xf_index = in.readShort(); field_4_string_len = in.readShort(); field_5_unicode_flag = in.readByte(); if (field_4_string_len > 0) { if (isUnCompressedUnicode()) { field_6_value = in.readUnicodeLEString(field_4_string_len); } else { field_6_value = in.readCompressedUnicode(field_4_string_len); } } else { field_6_value = ""; } if (in.remaining() > 0) { logger.log( POILogger.INFO, "LabelRecord data remains: " + in.remaining() + " : " + HexDump.toHex(in.readRemainder())); } }
public BOFRecord(RecordInputStream in) { field_1_version = in.readShort(); field_2_type = in.readShort(); // Some external tools don't generate all of // the remaining fields if (in.remaining() >= 2) { field_3_build = in.readShort(); } if (in.remaining() >= 2) { field_4_year = in.readShort(); } if (in.remaining() >= 4) { field_5_history = in.readInt(); } if (in.remaining() >= 4) { field_6_rversion = in.readInt(); } }
public ExternSheetRecord(RecordInputStream in) { _list = new ArrayList<RefSubRecord>(); int nItems = in.readShort(); for (int i = 0; i < nItems; ++i) { RefSubRecord rec = new RefSubRecord(in); _list.add(rec); } }
/** * called by the constructor, should set class level fields. Should throw runtime exception for * bad/incomplete data. * * @param in the stream to read from */ public SupBookRecord(RecordInputStream in) { int recLen = in.remaining(); field_1_number_of_sheets = in.readShort(); if (recLen > SMALL_RECORD_SIZE) { // 5.38.1 External References _isAddInFunctions = false; field_2_encoded_url = in.readString(); String[] sheetNames = new String[field_1_number_of_sheets]; for (int i = 0; i < sheetNames.length; i++) { sheetNames[i] = in.readString(); } field_3_sheet_names = sheetNames; return; } // else not 'External References' field_2_encoded_url = null; field_3_sheet_names = null; short nextShort = in.readShort(); if (nextShort == TAG_INTERNAL_REFERENCES) { // 5.38.2 'Internal References' _isAddInFunctions = false; } else if (nextShort == TAG_ADD_IN_FUNCTIONS) { // 5.38.3 'Add-In Functions' _isAddInFunctions = true; if (field_1_number_of_sheets != 1) { throw new RuntimeException( "Expected 0x0001 for number of sheets field in 'Add-In Functions' but got (" + field_1_number_of_sheets + ")"); } } else { throw new RuntimeException( "invalid EXTERNALBOOK code (" + Integer.toHexString(nextShort) + ")"); } }
public SeriesRecord(RecordInputStream in) { field_1_categoryDataType = in.readShort(); field_2_valuesDataType = in.readShort(); field_3_numCategories = in.readShort(); field_4_numValues = in.readShort(); field_5_bubbleSeriesType = in.readShort(); field_6_numBubbleValues = in.readShort(); }
private static void processFontRuns( RecordInputStream in, HSSFRichTextString str, int formattingRunDataLength) { if (formattingRunDataLength % FORMAT_RUN_ENCODED_SIZE != 0) { throw new RecordFormatException( "Bad format run data length " + formattingRunDataLength + ")"); } int nRuns = formattingRunDataLength / FORMAT_RUN_ENCODED_SIZE; for (int i = 0; i < nRuns; i++) { short index = in.readShort(); short iFont = in.readShort(); in.readInt(); // skip reserved. str.applyFont(index, str.length(), iFont); } }
public UncalcedRecord(RecordInputStream in) { // NO_UCD in.readShort(); // unused }
public BackupRecord(RecordInputStream in) { field_1_backup = in.readShort(); }
public BookBoolRecord(RecordInputStream in) { field_1_save_link_values = in.readShort(); }
/** @param in the RecordInputstream to read the record from */ public RefSubRecord(RecordInputStream in) { this(in.readShort(), in.readShort(), in.readShort()); }
public HyperlinkRecord(RecordInputStream in) { _range = new CellRangeAddress(in); _guid = new GUID(in); /** * streamVersion (4 bytes): An unsigned integer that specifies the version number of the * serialization implementation used to save this structure. This value MUST equal 2. */ int streamVersion = in.readInt(); if (streamVersion != 0x00000002) { throw new RecordFormatException("Stream Version must be 0x2 but found " + streamVersion); } _linkOpts = in.readInt(); if ((_linkOpts & HLINK_LABEL) != 0) { int label_len = in.readInt(); _label = in.readUnicodeLEString(label_len); } if ((_linkOpts & HLINK_TARGET_FRAME) != 0) { int len = in.readInt(); _targetFrame = in.readUnicodeLEString(len); } if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) != 0) { _moniker = null; int nChars = in.readInt(); _address = in.readUnicodeLEString(nChars); } if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) == 0) { _moniker = new GUID(in); if (URL_MONIKER.equals(_moniker)) { int length = in.readInt(); /** * The value of <code>length<code> be either the byte size of the url field * (including the terminating NULL character) or the byte size of the url field plus 24. * If the value of this field is set to the byte size of the url field, * then the tail bytes fields are not present. */ int remaining = in.remaining(); if (length == remaining) { int nChars = length / 2; _address = in.readUnicodeLEString(nChars); } else { int nChars = (length - TAIL_SIZE) / 2; _address = in.readUnicodeLEString(nChars); /** * TODO: make sense of the remaining bytes According to the spec they consist of: 1. * 16-byte GUID: This field MUST equal {0xF4815879, 0x1D3B, 0x487F, 0xAF, 0x2C, 0x82, * 0x5D, 0xC4, 0x85, 0x27, 0x63} 2. Serial version, this field MUST equal 0 if present. 3. * URI Flags */ _uninterpretedTail = readTail(URL_TAIL, in); } } else if (FILE_MONIKER.equals(_moniker)) { _fileOpts = in.readShort(); int len = in.readInt(); _shortFilename = StringUtil.readCompressedUnicode(in, len); _uninterpretedTail = readTail(FILE_TAIL, in); int size = in.readInt(); if (size > 0) { int charDataSize = in.readInt(); // From the spec: An optional unsigned integer that MUST be 3 if present // but some files has 4 int usKeyValue = in.readUShort(); _address = StringUtil.readUnicodeLE(in, charDataSize / 2); } else { _address = null; } } else if (STD_MONIKER.equals(_moniker)) { _fileOpts = in.readShort(); int len = in.readInt(); byte[] path_bytes = new byte[len]; in.readFully(path_bytes); _address = new String(path_bytes); } } if ((_linkOpts & HLINK_PLACE) != 0) { int len = in.readInt(); _textMark = in.readUnicodeLEString(len); } if (in.remaining() > 0) { logger.log( POILogger.WARN, "Hyperlink data remains: " + in.remaining() + " : " + HexDump.toHex(in.readRemainder())); } }