/** Creates new Ico Multi-State Threshold */ public IconMultiStateThreshold(LittleEndianInput in) { super(in); equals = in.readByte(); // Reserved, 4 bytes, all 0 in.readInt(); }
/** * Reads an 8 bit, signed value */ @Override public byte readByte() { checkRecordPosition(LittleEndianConsts.BYTE_SIZE); _currentDataOffset += LittleEndianConsts.BYTE_SIZE; return _dataInput.readByte(); }
public static BoolPtg read(LittleEndianInput in) { return valueOf(in.readByte() == 1); }
public static ErrPtg read(LittleEndianInput in) { return valueOf(in.readByte()); }
public IconMultiStateFormatting(LittleEndianInput in) { in.readShort(); // Ignored in.readByte(); // Reserved int num = in.readByte(); int set = in.readByte(); iconSet = IconSet.byId(set); if (iconSet.num != num) { log.log(POILogger.WARN, "Inconsistent Icon Set defintion, found " + iconSet + " but defined as " + num + " entries"); } options = in.readByte(); thresholds = new Threshold[iconSet.num]; for (int i=0; i<thresholds.length; i++) { thresholds[i] = new IconMultiStateThreshold(in); } }
public DataBarFormatting(LittleEndianInput in) { in.readShort(); // Ignored in.readByte(); // Reserved options = in.readByte(); percentMin = in.readByte(); percentMax = in.readByte(); if (percentMin < 0 || percentMin > 100) log.log(POILogger.WARN, "Inconsistent Minimum Percentage found " + percentMin); if (percentMax < 0 || percentMax > 100) log.log(POILogger.WARN, "Inconsistent Minimum Percentage found " + percentMin); color = new ExtendedColor(in); thresholdMin = new DataBarThreshold(in); thresholdMax = new DataBarThreshold(in); }
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); } }
/**Creates new function pointer from a byte array * usually called while reading an excel file. */ public static FuncVarPtg create(LittleEndianInput in) { return create(in.readByte(), in.readShort()); }
/** * InputStream <tt>in</tt> is expected to contain: * <ol> * <li>byte is16BitFlag</li> * <li>byte[]/char[] characterData</li> * </ol> * For this encoding, the is16BitFlag is always present even if nChars==0. * <br> * This method should be used when the nChars field is <em>not</em> stored * as a ushort immediately before the is16BitFlag. Otherwise, {@link * #readUnicodeString(LittleEndianInput)} can be used. */ public static String readUnicodeString(LittleEndianInput in, int nChars) { byte is16Bit = in.readByte(); if ((is16Bit & 0x01) == 0) { return readCompressedUnicode(in, nChars); } return readUnicodeLE(in, nChars); }
/** 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); } }
private static Ptg readRefPtg(byte[] formulaRawBytes) { LittleEndianInput in = new LittleEndianInputStream(new ByteArrayInputStream(formulaRawBytes)); byte ptgSid = in.readByte(); switch(ptgSid) { case AreaPtg.sid: return new AreaPtg(in); case Area3DPtg.sid: return new Area3DPtg(in); case RefPtg.sid: return new RefPtg(in); case Ref3DPtg.sid: return new Ref3DPtg(in); } return null; }
/** * InputStream <tt>in</tt> is expected to contain: * <ol> * <li>ushort nChars</li> * <li>byte is16BitFlag</li> * <li>byte[]/char[] characterData</li> * </ol> * For this encoding, the is16BitFlag is always present even if nChars==0. * <p> * This structure is also known as a XLUnicodeString. */ public static String readUnicodeString(LittleEndianInput in) { int nChars = in.readUShort(); byte flag = in.readByte(); if ((flag & 0x01) == 0) { return readCompressedUnicode(in, nChars); } return readUnicodeLE(in, nChars); }
public static String readUtf8LPP4(LittleEndianInput is) { int length = is.readInt(); if (length == 0 || length == 4) { /* int skip = */ is.readInt(); return length == 0 ? null : ""; } byte data[] = IOUtils.safelyAllocate(length, MAX_RECORD_LENGTH); is.readFully(data); // Padding (variable): A set of bytes that MUST be of correct size such that the size of the UTF-8-LP-P4 // structure is a multiple of 4 bytes. If Padding is present, each byte MUST be 0x00. If // the length is exactly 0x00000000, this specifies a null string, and the entire structure uses // exactly 4 bytes. If the length is exactly 0x00000004, this specifies an empty string, and the // entire structure also uses exactly 4 bytes int scratchedBytes = length%4; if (scratchedBytes > 0) { for (int i=0; i<(4-scratchedBytes); i++) { is.readByte(); } } return new String(data, 0, data.length, StandardCharsets.UTF_8); }
/** Creates new Threshold */ protected Threshold(LittleEndianInput in) { type = in.readByte(); short formulaLen = in.readShort(); if (formulaLen > 0) { formula = Formula.read(formulaLen, in); } else { formula = Formula.create(null); } // Value is only there for non-formula, non min/max thresholds if (formulaLen == 0 && type != RangeType.MIN.id && type != RangeType.MAX.id) { value = in.readDouble(); } }
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) {
public LbsDropData(LittleEndianInput in){ _wStyle = in.readUShort(); _cLine = in.readUShort(); _dxMin = in.readUShort(); _str = StringUtil.readUnicodeString(in); if(StringUtil.getEncodedSize(_str) % 2 != 0){ _unused = in.readByte(); } }
public static Ptg createPtg(LittleEndianInput in) { byte id = in.readByte(); if (id < 0x20) { return createBasePtg(id, in); } Ptg retval = createClassifiedPtg(id, in); if (id >= 0x60) { retval.setClass(CLASS_ARRAY); } else if (id >= 0x40) { retval.setClass(CLASS_VALUE); } else { retval.setClass(CLASS_REF); } return retval; }
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 + ")"); }