Class POIDocument

    • Method Detail

      • getDocumentSummaryInformation

        public DocumentSummaryInformation getDocumentSummaryInformation()
        Fetch the Document Summary Information of the document
        Returns:
        The Document Summary Information or null if it could not be read for this document.
      • getSummaryInformation

        public SummaryInformation getSummaryInformation()
        Fetch the Summary Information of the document
        Returns:
        The Summary information for the document or null if it could not be read for this document.
      • createInformationProperties

        public void createInformationProperties()
        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.
      • write

        public abstract void write​(File newFile)
                            throws IOException
        Writes the document out to the specified new File. If the file exists, it will be replaced, otherwise a new one will be created
        Parameters:
        newFile - The new File to write to.
        Throws:
        IOException - thrown on errors writing to the file
        Since:
        POI 3.15 beta 3
      • write

        public abstract void write​(OutputStream out)
                            throws IOException
        Writes the document out to the specified output stream. The stream is not closed as part of this operation. Note - if the Document was opened from a File rather than an InputStream, you must write out using write() or to a different File. Overwriting the currently open file via an OutputStream isn't possible. If stream is a FileOutputStream on a networked drive or has a high cost/latency associated with each written byte, consider wrapping the OutputStream in a BufferedOutputStream to improve write performance, or use write() / write(File) if possible.
        Parameters:
        out - The stream to write to.
        Throws:
        IOException - thrown on errors writing to the stream
      • close

        public void close()
                   throws IOException
        Closes the underlying POIFSFileSystem from which the document was read, if any. Has no effect on documents opened from an InputStream, or newly created ones.

        Once close() has been called, no further operations should be called on the document.

        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Throws:
        IOException
      • getEncryptionInfo

        public EncryptionInfo getEncryptionInfo()
                                         throws IOException
        Returns:
        the encryption info if the document is encrypted, otherwise null
        Throws:
        IOException - If retrieving the encryption information fails