/** * @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 + ")"); } }
throw new TikaException(e.getMessage(), e); } catch (RuntimeException e) { //convert Runtime to RecordFormatExceptions throw new TikaException(e.getMessage(), e);
throw new TikaException(e.getMessage(), e); } catch (RuntimeException e) { //convert Runtime to RecordFormatExceptions throw new TikaException(e.getMessage(), e);
/** * 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 final int getRecordSize() { throw new RecordFormatException("Cannot serialize a dummy record"); } }
public int serialize(int offset, byte[] data) { throw new RecordFormatException("Cannot serialize a dummy record"); } public final int getRecordSize() {
@Override public int getRecordSize() { throw new RecordFormatException("Label Records are supported READ ONLY...convert to LabelSST"); }
@Override protected int getDataSize() { throw new RecordFormatException( "Sorry, you can't serialize MulRK in this release"); }
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 int getRecordSize() { throw new RecordFormatException("Old Label Records are supported READ ONLY"); }
/** * Syntactic sugar to check whether a RecordFormatException should * be thrown. If assertTrue is <code>false</code>, this will throw this * exception with the message. * * @param assertTrue If false, the exception is thrown, if true, no action is performed * @param message The message to include in the thrown exception */ public static void check(boolean assertTrue, String message) { if (! assertTrue) { throw new RecordFormatException(message); } } }
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]; }
@Override public Record create(RecordInputStream in) { Object[] args = { in, }; try { return (Record) _m.invoke(null, args); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new org.apache.poi.util.RecordFormatException("Unable to construct record instance" , e.getTargetException()); } } @Override
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()) + ")"); } }