public Entry getEntry(String name) throws FileNotFoundException { if (excludes.contains(name)) { throw new FileNotFoundException(name); } Entry entry = directory.getEntry(name); return wrapEntry(entry); } private Entry wrapEntry(Entry entry) {
@Override public DirectoryEntry getDirectory() throws IOException { EmbeddedObjectRefSubRecord subRecord = findObjectRecord(); int streamId = subRecord.getStreamId().intValue(); String streamName = "MBD" + HexDump.toHex(streamId); Entry entry = _root.getEntry(streamName); if (entry instanceof DirectoryEntry) { return (DirectoryEntry) entry; } throw new IOException("Stream " + streamName + " was not an OLE2 directory"); }
InputStream inp = null; try { DocumentEntry entry = (DocumentEntry)dir.getEntry(name); inp = new DocumentInputStream(entry); try {
/** * Writes a property set to a document in a POI filesystem directory. * * @param dir The directory in the POI filesystem to write the document to. * @param name The document's name. If there is already a document with the * same name in the directory the latter will be overwritten. * * @throws WritingNotSupportedException if the filesystem doesn't support writing * @throws IOException if the old entry can't be deleted or the new entry be written */ public void write(final DirectoryEntry dir, final String name) throws WritingNotSupportedException, IOException { /* If there is already an entry with the same name, remove it. */ if (dir.hasEntry(name)) { final Entry e = dir.getEntry(name); e.delete(); } /* Create the new entry. */ dir.createDocument(name, toInputStream()); }
public static DocumentEntry createEncryptionEntry(DirectoryEntry dir, String path, EncryptionRecord out) throws IOException { String parts[] = path.split("/"); for (int i=0; i<parts.length-1; i++) { dir = dir.hasEntry(parts[i]) ? (DirectoryEntry)dir.getEntry(parts[i]) : dir.createDirectory(parts[i]); } final byte buf[] = new byte[5000]; LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0); out.write(bos); String fileName = parts[parts.length-1]; if (dir.hasEntry(fileName)) { dir.getEntry(fileName).delete(); } return dir.createDocument(fileName, bos.getWriteIndex(), new POIFSWriterListener(){ public void processPOIFSWriterEvent(POIFSWriterEvent event) { try { event.getStream().write(buf, 0, event.getLimit()); } catch (IOException e) { throw new EncryptedDocumentException(e); } } }); }
Iterator<String> iter = entryNames.iterator(); while (iter.hasNext()) { org.apache.poi.poifs.filesystem.Entry tmpEntry = dir.getEntry(iter.next()); if (tmpEntry instanceof DirectoryEntry) { dir = (DirectoryEntry) tmpEntry;
Entry e = root.getEntry("\u0001CompObj"); if (e != null && e.isDocumentEntry()) { DocumentNode dn = (DocumentNode) e;
public Entry getEntry(String name) throws FileNotFoundException { if (excludes.contains(name)) { throw new FileNotFoundException(name); } Entry entry = directory.getEntry(name); return wrapEntry(entry); } private Entry wrapEntry(Entry entry) {
public Entry getEntry(String name) throws FileNotFoundException { if (excludes.contains(name)) { throw new FileNotFoundException(name); } Entry entry = directory.getEntry(name); return wrapEntry(entry); } private Entry wrapEntry(Entry entry) {
@Override public DirectoryEntry getDirectory() throws IOException { EmbeddedObjectRefSubRecord subRecord = findObjectRecord(); int streamId = subRecord.getStreamId().intValue(); String streamName = "MBD" + HexDump.toHex(streamId); Entry entry = _root.getEntry(streamName); if (entry instanceof DirectoryEntry) { return (DirectoryEntry) entry; } throw new IOException("Stream " + streamName + " was not an OLE2 directory"); }
/** * {@inheritDoc} */ @Override protected VarMeta getCalendarVarMeta(DirectoryEntry directory) throws IOException { return new VarMeta9(new DocumentInputStream(((DocumentEntry) directory.getEntry("VarMeta")))); }
/** * {@inheritDoc} */ @Override protected VarMeta getCalendarVarMeta(DirectoryEntry directory) throws IOException { return new VarMeta12(new DocumentInputStream(((DocumentEntry) directory.getEntry("VarMeta")))); }
/** * {@inheritDoc} */ @Override protected VarMeta getCalendarVarMeta(DirectoryEntry directory) throws IOException { return new VarMeta12(new DocumentInputStream(((DocumentEntry) directory.getEntry("VarMeta")))); }
InputStream stream = new FileInputStream("C:\\Thumbs.db"); POIFSFileSystem fs = new POIFSFileSystem(stream); DirectoryEntry root = fs.getRoot(); Entry entry = root.getEntry("2"); DocumentInputStream is = fs.createDocumentInputStream(entry.getName()); //Added to read the header lines and fix the ImageFormatException int header_len = is.read(); for (int i = 1; i < header_len; i++) { is.read(); } JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(is); JPEGDecodeParam param = JPEGCodec.getDefaultJPEGEncodeParam(4,JPEGDecodeParam.COLOR_ID_RGBA); decoder.setJPEGDecodeParam(param); BufferedImage originalBufferedImage = decoder.decodeAsBufferedImage();
/** * Process the project properties data. */ private void processProjectProperties() throws MPXJException, IOException { Props8 props = new Props8(new DocumentInputStream(((DocumentEntry) m_projectDir.getEntry("Props")))); ProjectPropertiesReader reader = new ProjectPropertiesReader(); reader.process(m_file, props, m_root); }
/** * Process the project properties data. */ private void processProjectProperties() throws MPXJException, IOException { Props8 props = new Props8(new DocumentInputStream(((DocumentEntry) m_projectDir.getEntry("Props")))); ProjectPropertiesReader reader = new ProjectPropertiesReader(); reader.process(m_file, props, m_root); }
/** * This method extracts and collates the value list information * for custom column value lists. */ private void processCustomValueLists() throws IOException { DirectoryEntry taskDir = (DirectoryEntry) m_projectDir.getEntry("TBkndTask"); Props taskProps = new Props12(m_inputStreamFactory.getInstance(taskDir, "Props")); CustomFieldValueReader12 reader = new CustomFieldValueReader12(m_file.getProjectProperties(), m_file.getCustomFields(), m_outlineCodeVarMeta, m_outlineCodeVarData, m_outlineCodeFixedData, m_outlineCodeFixedData2, taskProps); reader.process(); }
/** * This method extracts and collates the value list information * for custom column value lists. * @throws IOException */ private void processCustomValueLists() throws IOException { DirectoryEntry taskDir = (DirectoryEntry) m_projectDir.getEntry("TBkndTask"); Props taskProps = new Props14(m_inputStreamFactory.getInstance(taskDir, "Props")); CustomFieldValueReader14 reader = new CustomFieldValueReader14(m_file.getProjectProperties(), m_file.getCustomFields(), m_outlineCodeVarMeta, m_outlineCodeVarData, m_outlineCodeFixedData, m_outlineCodeFixedData2, taskProps); reader.process(); }
/** * This method process the data held in the props file specific to the * visual appearance of the project data. */ private void processViewPropertyData() throws IOException { Props8 props = new Props8(new DocumentInputStream(((DocumentEntry) m_viewDir.getEntry("Props")))); ProjectProperties properties = m_file.getProjectProperties(); properties.setShowProjectSummaryTask(props.getBoolean(Props.SHOW_PROJECT_SUMMARY_TASK)); }