private static int readUShortAndCheck(LittleEndianInput in) { if (in.available() < ENCODED_SIZE) { // Ran out of data throw new RuntimeException("Ran out of data reading CellRangeAddress"); } return in.readUShort(); }
private static Object readAConstantValue(LittleEndianInput in) { byte grbit = in.readByte(); switch(grbit) { case TYPE_EMPTY: in.readLong(); // 8 byte 'not used' field return EMPTY_REPRESENTATION; case TYPE_NUMBER: return Double.valueOf(in.readDouble()); case TYPE_STRING: return StringUtil.readUnicodeString(in); case TYPE_BOOLEAN: return readBoolean(in); case TYPE_ERROR_CODE: int errCode = in.readUShort(); // next 6 bytes are unused in.readUShort(); in.readInt(); return ErrorConstant.valueOf(errCode); } throw new RuntimeException("Unknown grbit value (" + grbit + ")"); }
public ExtendedColor(LittleEndianInput in) { type = in.readInt(); if (type == TYPE_INDEXED) { colorIndex = in.readInt(); } else if (type == TYPE_RGB) { rgba = new byte[4]; in.readFully(rgba); } else if (type == TYPE_THEMED) { themeIndex = in.readInt(); } else { // Ignored in.readInt(); } tint = in.readDouble(); }
public Initial(LittleEndianInput in) { _reserved0 = in.readInt(); _reserved1 = in.readUShort(); _reserved2 = in.readUByte(); } private static RuntimeException invalid() {
public DeletedArea3DPtg(LittleEndianInput in) { field_1_index_extern_sheet = in.readUShort(); unused1 = in.readInt(); unused2 = in.readInt(); } public String toFormulaString(FormulaRenderingWorkbook book) {
LittleEndianInput in = new LittleEndianByteArrayInputStream(remainder); field_1_option_flag = in.readShort(); field_2_keyboard_shortcut = in.readByte(); int field_3_length_name_text = in.readUByte(); int field_4_length_name_definition = in.readShort(); field_5_externSheetIndex_plus1 = in.readShort(); field_6_sheetNumber = in.readUShort(); int f7_customMenuLen = in.readUByte(); int f8_descriptionTextLen = in.readUByte(); int f9_helpTopicTextLen = in.readUByte(); int f10_statusBarTextLen = in.readUByte(); field_11_nameIsMultibyte = (in.readByte() != 0); if (isBuiltInName()) { field_12_built_in_code = in.readByte(); } else { if (field_11_nameIsMultibyte) { int nBytesAvailable = in.available() - (f7_customMenuLen + f8_descriptionTextLen + f9_helpTopicTextLen + f10_statusBarTextLen); field_13_name_definition = Formula.read(field_4_length_name_definition, in, nBytesAvailable);
public ColorGradientFormatting(LittleEndianInput in) { in.readShort(); // Ignored in.readByte(); // Reserved int numI = in.readByte(); int numG = in.readByte(); if (numI != numG) { log.log(POILogger.WARN, "Inconsistent Color Gradient defintion, found " + numI + " vs " + numG + " entries"); } options = in.readByte(); thresholds = new ColorGradientThreshold[numI]; for (int i=0; i<thresholds.length; i++) { thresholds[i] = new ColorGradientThreshold(in); } colors = new ExtendedColor[numG]; for (int i=0; i<colors.length; i++) { in.readDouble(); // Slightly pointless step counter colors[i] = new ExtendedColor(in); } }
public FormulaRecord(RecordInputStream ris) { super(ris); LittleEndianInput in = ris; long valueLongBits = in.readLong(); field_5_options = in.readShort(); specialCachedValue = SpecialCachedValue.create(valueLongBits); if (specialCachedValue == null) { field_4_value = Double.longBitsToDouble(valueLongBits); } field_6_zero = in.readInt(); int field_7_expression_len = in.readShort(); // this length does not include any extra array data int nBytesAvailable = in.available(); field_8_parsed_expr = Formula.read(field_7_expression_len, in, nBytesAvailable); }
public GUID(LittleEndianInput in) { this(in.readInt(), in.readUShort(), in.readUShort(), in.readLong()); }
public CommonObjectDataSubRecord(LittleEndianInput in, int size) { if (size != 18) { throw new RecordFormatException("Expected size 18 but got (" + size + ")"); } field_1_objectType = in.readShort(); field_2_objectId = in.readUShort(); field_3_option = in.readShort(); field_4_reserved1 = in.readInt(); field_5_reserved2 = in.readInt(); field_6_reserved3 = in.readInt(); }
/** Create a StringPtg from a stream */ public StringPtg(LittleEndianInput in) { int nChars = in.readUByte(); // Note - nChars is 8-bit _is16bitUnicode = (in.readByte() & 0x01) != 0; if (_is16bitUnicode) { field_3_string = StringUtil.readUnicodeLE(in, nChars); } else { field_3_string = StringUtil.readCompressedUnicode(in, nChars); } }
public AttrPtg(LittleEndianInput in) { _options = in.readByte(); _data = in.readShort(); if (isOptimizedChoose()) { int[] jumpTable = new int[(int) _data]; for (int i = 0; i < jumpTable.length; i++) { jumpTable[i] = in.readUShort(); } _jumpTable = jumpTable; _chooseFuncOffset = in.readUShort(); } else { _jumpTable = null; _chooseFuncOffset = -1; } } private AttrPtg(int options, int data, int[] jt, int chooseFuncOffset) {
private static byte[] readTail(byte[] expectedTail, LittleEndianInput in) { byte[] result = new byte[TAIL_SIZE]; in.readFully(result); // if (false) { // Quite a few examples in the unit tests which don't have the exact expected tail // for (int i = 0; i < expectedTail.length; i++) { // if (expectedTail[i] != result[i]) { // logger.log( POILogger.ERROR, "Mismatch in tail byte [" + i + "]" // + "expected " + (expectedTail[i] & 0xFF) + " but got " + (result[i] & 0xFF)); // } // } // } return result; } private static void writeTail(byte[] tail, LittleEndianOutput out) {
protected StandardEncryptionHeader(LittleEndianInput is) throws IOException { setFlags(is.readInt()); setSizeExtra(is.readInt()); setCipherAlgorithm(CipherAlgorithm.fromEcmaId(is.readInt())); setHashAlgorithm(HashAlgorithm.fromEcmaId(is.readInt())); int keySize = is.readInt(); if (keySize == 0) { setCipherProvider(CipherProvider.fromEcmaId(is.readInt())); is.readLong(); // skip reserved ((InputStream)is).mark(LittleEndianConsts.INT_SIZE+1); int checkForSalt = is.readInt(); if (is instanceof RecordInputStream) { ((RecordInputStream)is).reset(); StringBuilder builder = new StringBuilder(); while (true) { char c = (char) is.readShort(); if (c == 0) { break;
private static Object readBoolean(LittleEndianInput in) { byte val = (byte)in.readLong(); // 7 bytes 'not used' switch(val) { case FALSE_ENCODING: return Boolean.FALSE; case TRUE_ENCODING: return Boolean.TRUE; } // Don't tolerate unusual boolean encoded values (unless it becomes evident that they occur) throw new RuntimeException("unexpected boolean encoding (" + val + ")"); }
/** Creates new NamePtg */ public NamePtg(LittleEndianInput in) { field_1_label_index = in.readUShort(); field_2_zero = in.readShort(); }