/** * @param in unused (since this record has no data) * @param size must be 0 */ public EndSubRecord(LittleEndianInput in, int size) { if ((size & 0xFF) != ENCODED_SIZE) { // mask out random crap in upper byte throw new RecordFormatException("Unexpected size (" + size + ")"); } }
/** * Not supported * * @param offset not supported * @param data not supported * @return not supported */ public int serialize(int offset, byte [] data) { throw new RecordFormatException("Old Label Records are supported READ ONLY"); }
@Override public void serialize(LittleEndianOutput out) { throw new RecordFormatException( "Sorry, you can't serialize MulRK in this release"); } @Override
private static void throwRFE(long length, int maxLength) { throw new RecordFormatException("Tried to allocate an array of length "+length + ", but "+ maxLength+" is the maximum for this record type.\n" + "If the file is not corrupt, please open an issue on bugzilla to request \n" + "increasing the maximum allowable size for this record type.\n"+ "As a temporary workaround, consider setting a higher override value with " + "IOUtils.setByteArrayMaxOverride()"); } }
/** * THROWS A RUNTIME EXCEPTION.. USE LABELSSTRecords. YOU HAVE NO REASON to use LABELRecord!! */ @Override public int serialize(int offset, byte [] data) { throw new RecordFormatException("Label Records are supported READ ONLY...convert to LabelSST"); } @Override
public int serialize(int offset, byte[] data) { throw new RecordFormatException("Cannot serialize a dummy record"); } public final int getRecordSize() {
public final int getRecordSize() { throw new RecordFormatException("Cannot serialize a dummy record"); } }
@Override public int getRecordSize() { throw new RecordFormatException("Label Records are supported READ ONLY...convert to LabelSST"); }
private static int parseHexChar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - 'A' + 10; } if (c >= 'a' && c <= 'f') { return c - 'a' + 10; } throw new RecordFormatException("Bad hex char '" + c + "'"); } }
public static byte[] safelyAllocate(long length, int maxLength) { if (length < 0L) { throw new RecordFormatException("Can't allocate an array of length < 0"); } if (length > (long)Integer.MAX_VALUE) { throw new RecordFormatException("Can't allocate an array > "+Integer.MAX_VALUE); } checkLength(length, maxLength); return new byte[(int)length]; }
public FtCfSubRecord(LittleEndianInput in, int size) { if (size != length) { throw new RecordFormatException("Unexpected size (" + size + ")"); } flags = in.readShort(); }
public FtPioGrbitSubRecord(LittleEndianInput in, int size) { if (size != length) { throw new RecordFormatException("Unexpected size (" + size + ")"); } flags = in.readShort(); }
private void checkNotPresent(Record rec) { if (rec != null) { throw new RecordFormatException("Duplicate PageSettingsBlock record (sid=0x" + Integer.toHexString(rec.getSid()) + ")"); } }
private void checkNotPresent(Record rec) { if (rec != null) { throw new org.apache.poi.util.RecordFormatException("Duplicate PageSettingsBlock record (sid=0x" + Integer.toHexString(rec.getSid()) + ")"); } }
public void visitRecord(Record r) { try { _destList.add((Record)r.clone()); } catch (CloneNotSupportedException e) { throw new RecordFormatException(e); } } }
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 FtCblsSubRecord(LittleEndianInput in, int size) { if (size != ENCODED_SIZE) { throw new RecordFormatException("Unexpected size (" + size + ")"); } //just grab the raw data byte[] buf = IOUtils.safelyAllocate(size, ENCODED_SIZE); in.readFully(buf); reserved = buf; }
public static Record create(RecordInputStream in) { switch (in.remaining()) { case 0: return instance; case 2: return new InterfaceHdrRecord(in); } throw new RecordFormatException("Invalid record data size: " + in.remaining()); }
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"); }
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(); }