POIFSFileSystem fsOut = null; try { int streamDescriptorArrayOffset = (int) leis.readUInt(); /* int streamDescriptorArraySize = (int) */ leis.readUInt(); long skipN = streamDescriptorArrayOffset - 8L; if (sbis.skip(skipN) < skipN) { int encryptedStreamDescriptorCount = (int) leis.readUInt(); StreamDescriptorEntry entries[] = new StreamDescriptorEntry[encryptedStreamDescriptorCount]; for (int i = 0; i < encryptedStreamDescriptorCount; i++) { StreamDescriptorEntry entry = new StreamDescriptorEntry(); entries[i] = entry; entry.streamOffset = (int) leis.readUInt(); entry.streamSize = (int) leis.readUInt(); entry.block = leis.readUShort(); int nameSize = leis.readUByte();
@Override public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException { mapperValues = leis.readUInt(); return LittleEndianConsts.INT_SIZE; }
private HemfRecord _next() { if (currentRecord != null && currentRecord.getRecordType().equals(HemfRecordType.eof)) { return null; } long recordId = stream.readUInt(); long recordSize = stream.readUInt(); HemfRecord record = null; HemfRecordType type = HemfRecordType.getById(recordId); if (type == null) { throw new RuntimeException("Undefined record of type:"+recordId); } try { record = type.clazz.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } try { record.init(stream, recordId, recordSize-8); } catch (IOException e) { throw new RecordFormatException(e); } return record; }
@Override public long init(LittleEndianInputStream leis, long recordId, long recordSize) throws IOException { //note that the first 2 uInts have been read off and the recordsize has //been decreased by 8 left = leis.readInt(); top = leis.readInt(); right = leis.readInt(); bottom = leis.readInt(); graphicsMode = leis.readUInt(); exScale = leis.readUInt(); eyScale = leis.readUInt(); int recordSizeInt = -1; if (recordSize < Integer.MAX_VALUE) { recordSizeInt = (int)recordSize; } else { throw new RecordFormatException("can't have text length > Integer.MAX_VALUE"); } //guarantee to read the rest of the EMRTextObjectRecord //emrtextbytes start after 7*4 bytes read above byte[] emrTextBytes = IOUtils.safelyAllocate(recordSizeInt-(7*LittleEndian.INT_SIZE), MAX_RECORD_LENGTH); IOUtils.readFully(leis, emrTextBytes); textObject = new EmrTextObject(emrTextBytes, getEncodingHint(), 20);//should be 28, but recordSizeInt has already subtracted 8 return recordSize; }
try { long recordSizeLong = leis.readUInt()*2; if (recordSizeLong > Integer.MAX_VALUE) { throw new RecordFormatException("record size can't be > "+Integer.MAX_VALUE);
POIFSFileSystem fsOut = null; try { int streamDescriptorArrayOffset = (int) leis.readUInt(); /* int streamDescriptorArraySize = (int) */ leis.readUInt(); long skipN = streamDescriptorArrayOffset - 8L; if (sbis.skip(skipN) < skipN) { int encryptedStreamDescriptorCount = (int) leis.readUInt(); StreamDescriptorEntry entries[] = new StreamDescriptorEntry[encryptedStreamDescriptorCount]; for (int i = 0; i < encryptedStreamDescriptorCount; i++) { StreamDescriptorEntry entry = new StreamDescriptorEntry(); entries[i] = entry; entry.streamOffset = (int) leis.readUInt(); entry.streamSize = (int) leis.readUInt(); entry.block = leis.readUShort(); int nameSize = leis.readUByte();
@Override public long init(LittleEndianInputStream leis, long recordId, long recordSize) throws IOException { long dataSize = leis.readUInt(); recordSize -= LittleEndian.INT_SIZE; byte[] optionalCommentIndentifierBuffer = new byte[4]; leis.readFully(optionalCommentIndentifierBuffer); dataSize = dataSize-LittleEndian.INT_SIZE; //size minus the first int which could be a comment identifier recordSize -= LittleEndian.INT_SIZE; long optionalCommentIdentifier = LittleEndian.getInt(optionalCommentIndentifierBuffer) & 0x00FFFFFFFFL; if (optionalCommentIdentifier == COMMENT_EMFSPOOL) { comment = new HemfCommentEMFSpool(readToByteArray(leis, dataSize, recordSize)); } else if (optionalCommentIdentifier == COMMENT_EMFPLUS) { comment = new HemfCommentEMFPlus(readToByteArray(leis, dataSize, recordSize)); } else if (optionalCommentIdentifier == COMMENT_PUBLIC) { comment = CommentPublicParser.parse(readToByteArray(leis, dataSize, recordSize)); } else { comment = new HemfComment(readToByteArray(optionalCommentIndentifierBuffer, leis, dataSize, recordSize)); } return recordSize; }
maxRecord = leis.readUInt(); bytesLeft -= LittleEndianConsts.INT_SIZE;