/** * Creates a new document summary information. * * @return the new document summary information. */ public static DocumentSummaryInformation newDocumentSummaryInformation() { return new DocumentSummaryInformation(); } }
return new SummaryInformation(stream); } else if (sectionCount > 0 && PropertySet.matchesSummary(clsId, DocumentSummaryInformation.FORMAT_ID)) { return new DocumentSummaryInformation(stream); } else { return new PropertySet(stream);
/** * Creates a new document summary information. * * @return the new document summary information. */ public static DocumentSummaryInformation newDocumentSummaryInformation() { return new DocumentSummaryInformation(); } }
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); } }
/** * <p>Creates a new document summary information.</p> * * @return the new document summary information. */ public static DocumentSummaryInformation newDocumentSummaryInformation() { final MutablePropertySet ps = new MutablePropertySet(); final MutableSection s = (MutableSection) ps.getFirstSection(); s.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]); try { return new DocumentSummaryInformation(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()); }
/** * <p>Creates a new document summary information.</p> * * @return the new document summary information. */ public static DocumentSummaryInformation newDocumentSummaryInformation() { final MutablePropertySet ps = new MutablePropertySet(); final MutableSection s = (MutableSection) ps.getFirstSection(); s.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]); try { return new DocumentSummaryInformation(ps); } catch (UnexpectedPropertySetTypeException ex) { /* This should never happen. */ throw new HPSFRuntimeException(ex); } }
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); else return ps;
return new SummaryInformation(ps); else if (ps.isDocumentSummaryInformation()) return new DocumentSummaryInformation(ps); else return 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); } else { return new PropertySet(stream);
DocumentSummaryInformation documentSummaryInformation = ps == null ? new DocumentSummaryInformation() : new DocumentSummaryInformation(ps); ph.setCategory(documentSummaryInformation.getCategory()); ph.setPresentationFormat(documentSummaryInformation.getPresentationFormat());
DocumentSummaryInformation documentSummaryInformation = ps == null ? new DocumentSummaryInformation() : new DocumentSummaryInformation(ps); ph.setCategory(documentSummaryInformation.getCategory()); ph.setPresentationFormat(documentSummaryInformation.getPresentationFormat());