/** * @return the number of bytes available in the current BIFF record * @see #remaining() */ @Override public int available() { return remaining(); }
/** * @param in unused (since this record has no data) */ public WriteProtectRecord(RecordInputStream in) { if (in.remaining() == 2) { in.readShort(); } }
public int read(byte[] b, int off, int len) { int limit = Math.min(len, remaining()); if (limit == 0) { return 0; } readFully(b, off,limit); return limit; }
public TabIdRecord(RecordInputStream in) { int nTabs = in.remaining() / 2; _tabids = new short[nTabs]; for (int i = 0; i < _tabids.length; i++) { _tabids[i] = in.readShort(); } }
public static RkRec[] parseRKs(RecordInputStream in) { int nItems = (in.remaining()-2) / ENCODED_SIZE; RkRec[] retval = new RkRec[nItems]; for (int i=0; i<nItems; i++) { retval[i] = new RkRec(in); } return retval; } }
private static int readUShortAndCheck(RecordInputStream in) { if (in.remaining() < ENCODED_SIZE) { // Ran out of data throw new RuntimeException("Ran out of data reading CellRangeAddress"); } return in.readUShort(); }
private static short [] parseXFs(RecordInputStream in) { short[] retval = new short[(in.remaining() - 2) / 2]; for (int idx = 0; idx < retval.length;idx++) { retval[idx] = in.readShort(); } return retval; }
public PageItemRecord(RecordInputStream in) { int dataSize = in.remaining(); if (dataSize % FieldInfo.ENCODED_SIZE != 0) { throw new RecordFormatException("Bad data size " + dataSize); } int nItems = dataSize / FieldInfo.ENCODED_SIZE; FieldInfo[] fis = new FieldInfo[nItems]; for (int i = 0; i < fis.length; i++) { fis[i] = new FieldInfo(in); } _fieldInfos = fis; }
public MMSRecord(RecordInputStream in) { if (in.remaining()==0) { return; } field_1_addMenuCount = in.readByte(); field_2_delMenuCount = in.readByte(); }
public DBCellRecord(RecordInputStream in) { field_1_row_offset = in.readUShort(); int size = in.remaining(); field_2_cell_offsets = new short[ size / 2 ]; for (int i=0;i<field_2_cell_offsets.length;i++) { field_2_cell_offsets[ i ] = in.readShort(); } }
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(); } }
/** Returns the remaining bytes for the current record. * * @return The remaining bytes of the current record. */ public byte[] readRemainder() { int size = remaining(); if (size ==0) { return EMPTY_BYTE_ARRAY; } byte[] result = IOUtils.safelyAllocate(size, MAX_RECORD_LENGTH); readFully(result); return result; }
/** * Note - this method is expected to be called only when completed reading the current BIFF * record. * * @return true, if there's another record in the stream * * @throws LeftoverDataException if this method is called before reaching the end of the * current record. */ public boolean hasNextRecord() throws LeftoverDataException { if (_currentDataLength != -1 && _currentDataLength != _currentDataOffset) { throw new LeftoverDataException(_currentSid, remaining()); } if (_currentDataLength != DATA_LEN_NEEDS_TO_BE_READ) { _nextSid = readNextSid(); } return _nextSid != INVALID_SID_VALUE; }
protected HeaderFooterBase(RecordInputStream in) { if (in.remaining() > 0) { int field_1_footer_len = in.readShort(); //61287 -- if the footer_len == 0, there may not be a multibyte flag if (field_1_footer_len == 0) { field_3_text = ""; if (in.remaining() == 0) { return; } } field_2_hasMultibyte = in.readByte() != 0x00; if (field_2_hasMultibyte) { field_3_text = in.readUnicodeLEString(field_1_footer_len); } else { field_3_text = in.readCompressedUnicode(field_1_footer_len); } } else { // Note - this is unusual for BIFF records in general, but normal for header / footer records: // when the text is empty string, the whole record is empty (just the 4 byte BIFF header) field_3_text = ""; } }
public ExtSSTRecord(RecordInputStream in) { _stringsPerBucket = in.readShort(); int nInfos = in.remaining() / InfoSubRecord.ENCODED_SIZE; ArrayList<InfoSubRecord> lst = new ArrayList<>(nInfos); while (in.available() > 0) { InfoSubRecord info = new InfoSubRecord(in); lst.add(info); if(in.available() == 0 && in.hasNextRecord() && in.getNextSid() == ContinueRecord.sid) { in.nextRecord(); } } _sstInfos = lst.toArray(new InfoSubRecord[lst.size()]); }
private void checkRecordPosition(int requiredByteCount) { int nAvailable = remaining(); if (nAvailable >= requiredByteCount) { // all OK return; } if (nAvailable == 0 && isContinueNext()) { nextRecord(); return; } throw new RecordFormatException("Not enough data (" + nAvailable + ") to read requested (" + requiredByteCount +") bytes"); }
/** * @param in the RecordInputstream to read the record from */ public OldLabelRecord(RecordInputStream in) { super(in, in.getSid() == biff2_sid); if (isBiff2()) { field_4_string_len = (short)in.readUByte(); } else { field_4_string_len = in.readShort(); } // Can only decode properly later when you know the codepage field_5_bytes = IOUtils.safelyAllocate(field_4_string_len, MAX_RECORD_LENGTH); in.read(field_5_bytes, 0, field_4_string_len); if (in.remaining() > 0) { logger.log(POILogger.INFO, "LabelRecord data remains: " + in.remaining() + " : " + HexDump.toHex(in.readRemainder()) ); } }
public WindowTwoRecord(RecordInputStream in) { int size = in.remaining(); field_1_options = in.readShort(); field_2_top_row = in.readShort(); field_3_left_col = in.readShort(); field_4_header_color = in.readInt(); if (size > 10) { field_5_page_break_zoom = in.readShort(); field_6_normal_zoom = in.readShort(); } if (size > 14) { // there is a special case of this record that has only 14 bytes...undocumented! field_7_reserved = in.readInt(); } }
public IndexRecord(RecordInputStream in) { int field_1_zero = in.readInt(); if (field_1_zero != 0) { throw new RecordFormatException("Expected zero for field 1 but got " + field_1_zero); } field_2_first_row = in.readInt(); field_3_last_row_add1 = in.readInt(); field_4_zero = in.readInt(); int nCells = in.remaining() / 4; field_5_dbcells = new IntList(nCells); for(int i=0; i<nCells; i++) { field_5_dbcells.add(in.readInt()); } }