inp = new DocumentInputStream(entry); try { return create(inp); } catch (MarkUnsupportedException e) { return null;
/** * Will create whichever of SummaryInformation * and DocumentSummaryInformation (HPSF) properties * are not already part of your document. * This is normally useful when creating a new * document from scratch. * If the information properties are already there, * then nothing will happen. */ public void createInformationProperties() { if (!initialized) { readProperties(); } if (sInf == null) { sInf = PropertySetFactory.newSummaryInformation(); } if (dsInf == null) { dsInf = newDocumentSummaryInformation(); } }
SummaryInformation si; try { si = (SummaryInformation) PropertySetFactory.create( dir, SummaryInformation.DEFAULT_STREAM_NAME); } catch (FileNotFoundException ex) { si = PropertySetFactory.newSummaryInformation(); dsi = (DocumentSummaryInformation) PropertySetFactory.create( dir, DocumentSummaryInformation.DEFAULT_STREAM_NAME); } catch (FileNotFoundException ex) { dsi = PropertySetFactory.newDocumentSummaryInformation();
writePropertySet(DocumentSummaryInformation.DEFAULT_STREAM_NAME, newDocumentSummaryInformation(), outFS);
writePropertySet(DocumentSummaryInformation.DEFAULT_STREAM_NAME, newDocumentSummaryInformation(), outFS);
@Override public boolean equals(Object other) { if (!(other instanceof DocumentDelegate)) { return false; } DocumentDelegate dd = (DocumentDelegate)other; if (this == dd) { return true; } if (!Objects.equals(doc.getName(), dd.doc.getName())) { // Names don't match, not the same return false; } try (DocumentInputStream inpA = new DocumentInputStream(doc); DocumentInputStream inpB = new DocumentInputStream(dd.doc)) { if (PropertySet.isPropertySetStream(inpA) && PropertySet.isPropertySetStream(inpB)) { final PropertySet ps1 = PropertySetFactory.create(inpA); final PropertySet ps2 = PropertySetFactory.create(inpB); return ps1.equals(ps2); } else { return isEqual(inpA, inpB); } } catch (MarkUnsupportedException | NoPropertySetStreamException | IOException ex) { throw new RuntimeException(ex); } }
/** * Will create whichever of SummaryInformation * and DocumentSummaryInformation (HPSF) properties * are not already part of your document. * This is normally useful when creating a new * document from scratch. * If the information properties are already there, * then nothing will happen. */ public void createInformationProperties() { if (!initialized) { readProperties(); } if (sInf == null) { sInf = PropertySetFactory.newSummaryInformation(); } if (dsInf == null) { dsInf = newDocumentSummaryInformation(); } }
return PropertySetFactory.create(dis);
/** * Will create whichever of SummaryInformation * and DocumentSummaryInformation (HPSF) properties * are not already part of your document. * This is normally useful when creating a new * document from scratch. * If the information properties are already there, * then nothing will happen. */ public void createInformationProperties() { if(!initialized) readProperties(); if(sInf == null) { sInf = PropertySetFactory.newSummaryInformation(); } if(dsInf == null) { dsInf = PropertySetFactory.newDocumentSummaryInformation(); } }
/** * <p>Creates a {@link PropertySetDescriptor} by reading a {@link * PropertySet} from a {@link DocumentInputStream}.</p> * * @param name The stream's name. * * @param path The stream's path in the POI filesystem hierarchy. * * @param stream The stream. * * @param nrOfBytesToDump The maximum number of bytes to display in a * dump starting at the beginning of the stream. */ public PropertySetDescriptor(final String name, final POIFSDocumentPath path, final DocumentInputStream stream, final int nrOfBytesToDump) throws NoPropertySetStreamException, MarkUnsupportedException, UnsupportedEncodingException, IOException { super(name, path, stream, nrOfBytesToDump); propertySet = PropertySetFactory.create(stream); }
/** * Will create whichever of SummaryInformation * and DocumentSummaryInformation (HPSF) properties * are not already part of your document. * This is normally useful when creating a new * document from scratch. * If the information properties are already there, * then nothing will happen. */ public void createInformationProperties() { if(!initialized) readProperties(); if(sInf == null) { sInf = PropertySetFactory.newSummaryInformation(); } if(dsInf == null) { dsInf = PropertySetFactory.newDocumentSummaryInformation(); } }
/** * <p>Creates a {@link PropertySetDescriptor} by reading a {@link * PropertySet} from a {@link DocumentInputStream}.</p> * * @param name The stream's name. * * @param path The stream's path in the POI filesystem hierarchy. * * @param stream The stream. * * @param nrOfBytesToDump The maximum number of bytes to display in a * dump starting at the beginning of the stream. */ public PropertySetDescriptor(final String name, final POIFSDocumentPath path, final DocumentInputStream stream, final int nrOfBytesToDump) throws NoPropertySetStreamException, MarkUnsupportedException, UnsupportedEncodingException, IOException { super(name, path, stream, nrOfBytesToDump); propertySet = PropertySetFactory.create(stream); }
/** * <p>Creates a {@link PropertySetDescriptor} by reading a {@link * PropertySet} from a {@link DocumentInputStream}.</p> * * @param name The stream's name. * * @param path The stream's path in the POI filesystem hierarchy. * * @param stream The stream. * * @param nrOfBytesToDump The maximum number of bytes to display in a * dump starting at the beginning of the stream. */ public PropertySetDescriptor(final String name, final POIFSDocumentPath path, final DocumentInputStream stream, final int nrOfBytesToDump) throws NoPropertySetStreamException, MarkUnsupportedException, UnsupportedEncodingException, IOException { super(name, path, stream, nrOfBytesToDump); propertySet = PropertySetFactory.create(stream); }
/** * @see org.apache.poi.poifs.eventfilesystem.POIFSReaderListener#processPOIFSReaderEvent(org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent) */ public void processPOIFSReaderEvent(POIFSReaderEvent event) { try { if ((m_summary == null) && event.getName().startsWith(SummaryInformation.DEFAULT_STREAM_NAME)) { m_summary = (SummaryInformation)PropertySetFactory.create(event.getStream()); return; } if ((m_documentSummary == null) && event.getName().startsWith(DocumentSummaryInformation.DEFAULT_STREAM_NAME)) { m_documentSummary = (DocumentSummaryInformation)PropertySetFactory.create(event.getStream()); return; } } catch (Exception e) { // ignore } }
/** * @see org.apache.poi.poifs.eventfilesystem.POIFSReaderListener#processPOIFSReaderEvent(org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent) */ public void processPOIFSReaderEvent(POIFSReaderEvent event) { try { if ((m_summary == null) && event.getName().startsWith(SummaryInformation.DEFAULT_STREAM_NAME)) { m_summary = (SummaryInformation)PropertySetFactory.create(event.getStream()); return; } if ((m_documentSummary == null) && event.getName().startsWith(DocumentSummaryInformation.DEFAULT_STREAM_NAME)) { m_documentSummary = (DocumentSummaryInformation)PropertySetFactory.create(event.getStream()); return; } } catch (RuntimeException e) { // ignore } catch (Exception e) { // ignore } }
@Override public void processPOIFSReaderEvent( POIFSReaderEvent event ) { try { SummaryInformation si = (SummaryInformation)PropertySetFactory.create(event.getStream()); setSummaryInformation(si); } catch (Exception ex) { LOGGER.debug("Error processing the metadata for the MS Office document", ex); } }
inp = new DocumentInputStream(entry); try { return create(inp); } catch (MarkUnsupportedException e) { return null;
@Override public void processPOIFSReaderEvent( POIFSReaderEvent event ) { try { SummaryInformation si = (SummaryInformation)PropertySetFactory.create(event.getStream()); setSummaryInformation(si); } catch (Exception ex) { LOGGER.debug("Error processing the metadata for the MS Office document", ex); } }
@Override public void processPOIFSReaderEvent(final POIFSReaderEvent event) { SummaryInformation si; try { si = (SummaryInformation) PropertySetFactory.create(event.getStream()); } catch (Exception ex) { throw new RuntimeException ("Property set stream \"" + event.getPath() + event.getName() + "\": " + ex); } final String title = si.getTitle(); if (title != null) System.out.println("Title: \"" + title + "\""); else System.out.println("Document has no title."); } }
@Override public boolean equals(Object other) { if (!(other instanceof DocumentDelegate)) { return false; } DocumentDelegate dd = (DocumentDelegate)other; if (this == dd) { return true; } if (!Objects.equals(doc.getName(), dd.doc.getName())) { // Names don't match, not the same return false; } try (DocumentInputStream inpA = new DocumentInputStream(doc); DocumentInputStream inpB = new DocumentInputStream(dd.doc)) { if (PropertySet.isPropertySetStream(inpA) && PropertySet.isPropertySetStream(inpB)) { final PropertySet ps1 = PropertySetFactory.create(inpA); final PropertySet ps2 = PropertySetFactory.create(inpB); return ps1.equals(ps2); } else { return isEqual(inpA, inpB); } } catch (MarkUnsupportedException | NoPropertySetStreamException | IOException ex) { throw new RuntimeException(ex); } }