/** * Creates a new summary information. * * @return the new summary information. */ public static SummaryInformation newSummaryInformation() { return new SummaryInformation(); }
return new SummaryInformation(stream); } else if (sectionCount > 0 && PropertySet.matchesSummary(clsId, DocumentSummaryInformation.FORMAT_ID)) { return new DocumentSummaryInformation(stream);
private void parseSummaryEntryIfExists( DirectoryNode root, String entryName) throws IOException, TikaException { try { DocumentEntry entry = (DocumentEntry) root.getEntry(entryName); PropertySet properties = new PropertySet(new DocumentInputStream(entry)); if (properties.isSummaryInformation()) { parse(new SummaryInformation(properties)); } if (properties.isDocumentSummaryInformation()) { parse(new DocumentSummaryInformation(properties)); } } catch (FileNotFoundException e) { // entry does not exist, just skip it } catch (NoPropertySetStreamException e) { // no property stream, just skip it } catch (UnexpectedPropertySetTypeException e) { throw new TikaException("Unexpected HPSF document", e); } catch (Exception e) { LOG.warn("Ignoring unexpected exception while parsing summary entry {}", entryName, e); } }
/** * Creates a new summary information. * * @return the new summary information. */ public static SummaryInformation newSummaryInformation() { return new SummaryInformation(); }
protected void sanitizeSummaryInformation(BleachSession session, DocumentEntry dsiEntry) { if (dsiEntry.getSize() <= 0) { return; } try (DocumentInputStream dis = new DocumentInputStream(dsiEntry)) { PropertySet ps = new PropertySet(dis); // Useful for debugging purposes // LOGGER.debug("PropertySet sections: {}", ps.getSections()); SummaryInformation dsi = new SummaryInformation(ps); sanitizeSummaryInformation(session, dsi); } catch (NoPropertySetStreamException | UnexpectedPropertySetTypeException | IOException e) { LOGGER.error("An error occured while trying to sanitize the document entry", e); } }
/** * <p>Creates a new summary information.</p> * * @return the new summary information. */ public static SummaryInformation newSummaryInformation() { final MutablePropertySet ps = new MutablePropertySet(); final MutableSection s = (MutableSection) ps.getFirstSection(); s.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID); try { return new SummaryInformation(ps); } catch (UnexpectedPropertySetTypeException ex) { /* This should never happen. */ throw new HPSFRuntimeException(ex); } }
/** * <p>Creates a new summary information.</p> * * @return the new summary information. */ public static SummaryInformation newSummaryInformation() { final MutablePropertySet ps = new MutablePropertySet(); final MutableSection s = (MutableSection) ps.getFirstSection(); s.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID); try { return new SummaryInformation(ps); } catch (UnexpectedPropertySetTypeException ex) { /* This should never happen. */ throw new HPSFRuntimeException(ex); } }
/** * Writes a {@link PropertySet} to a POI filesystem. * * @param poiFs The POI filesystem to write to. * @param path The file's path in the POI filesystem. * @param name The file's name in the POI filesystem. * @param ps The property set to write. */ public void copy(final POIFSFileSystem poiFs, final POIFSDocumentPath path, final String name, final PropertySet ps) throws WritingNotSupportedException, IOException { final DirectoryEntry de = getPath(poiFs, path); final PropertySet mps; try { if (ps instanceof DocumentSummaryInformation) { mps = new DocumentSummaryInformation(ps); } else if (ps instanceof SummaryInformation) { mps = new SummaryInformation(ps); } else { mps = new PropertySet(ps); } } catch (UnexpectedPropertySetTypeException e) { throw new IOException(e); } de.createDocument(name, mps.toInputStream()); }
private void parseSummaryEntryIfExists( DirectoryNode root, String entryName) throws IOException, TikaException { try { DocumentEntry entry = (DocumentEntry) root.getEntry(entryName); PropertySet properties = new PropertySet(new DocumentInputStream(entry)); if (properties.isSummaryInformation()) { parse(new SummaryInformation(properties)); } if (properties.isDocumentSummaryInformation()) { parse(new DocumentSummaryInformation(properties)); } } catch (FileNotFoundException e) { // entry does not exist, just skip it } catch (NoPropertySetStreamException e) { // no property stream, just skip it } catch (UnexpectedPropertySetTypeException e) { throw new TikaException("Unexpected HPSF document", e); } catch (Exception e) { LOG.warn("Ignoring unexpected exception while parsing summary entry {}", entryName, e); } }
return new SummaryInformation(ps); else if (ps.isDocumentSummaryInformation()) return new DocumentSummaryInformation(ps);
return new SummaryInformation(ps); else if (ps.isDocumentSummaryInformation()) return new DocumentSummaryInformation(ps);
private void parseSummaryEntryIfExists( DirectoryNode root, String entryName) throws IOException, TikaException { try { DocumentEntry entry = (DocumentEntry) root.getEntry(entryName); PropertySet properties = new PropertySet(new DocumentInputStream(entry)); if (properties.isSummaryInformation()) { parse(new SummaryInformation(properties)); } if (properties.isDocumentSummaryInformation()) { parse(new DocumentSummaryInformation(properties)); } } catch (FileNotFoundException e) { // entry does not exist, just skip it } catch (NoPropertySetStreamException e) { // no property stream, just skip it } catch (UnexpectedPropertySetTypeException e) { throw new TikaException("Unexpected HPSF document", e); } catch (MarkUnsupportedException e) { throw new TikaException("Invalid DocumentInputStream", e); } catch (Exception e) { logger.warn("Ignoring unexpected exception while parsing summary entry " + entryName, e); } }
return new SummaryInformation(stream); } else if (sectionCount > 0 && PropertySet.matchesSummary(clsId, DocumentSummaryInformation.FORMAT_ID)) { return new DocumentSummaryInformation(stream);
SummaryInformation summaryInformation = new SummaryInformation(ps); ph.setProjectTitle(summaryInformation.getTitle()); ph.setSubject(summaryInformation.getSubject());
SummaryInformation summaryInformation = new SummaryInformation(ps); ph.setProjectTitle(summaryInformation.getTitle()); ph.setSubject(summaryInformation.getSubject());