Search in sources :

Example 21 with DocumentInputStream

use of org.apache.poi.poifs.filesystem.DocumentInputStream in project poi by apache.

the class TestWriteWellKnown method getDocumentSummaryInformation.

static DocumentSummaryInformation getDocumentSummaryInformation(NPOIFSFileSystem poifs) throws IOException, NoPropertySetStreamException, UnexpectedPropertySetTypeException, MarkUnsupportedException {
    if (!poifs.getRoot().hasEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME)) {
        return null;
    }
    DocumentInputStream dis = poifs.createDocumentInputStream(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
    PropertySet ps = new PropertySet(dis);
    DocumentSummaryInformation dsi = new DocumentSummaryInformation(ps);
    dis.close();
    return dsi;
}
Also used : PropertySet(org.apache.poi.hpsf.PropertySet) DocumentSummaryInformation(org.apache.poi.hpsf.DocumentSummaryInformation) DocumentInputStream(org.apache.poi.poifs.filesystem.DocumentInputStream)

Example 22 with DocumentInputStream

use of org.apache.poi.poifs.filesystem.DocumentInputStream in project poi by apache.

the class BinaryRC4Decryptor method getDataStream.

@Override
@SuppressWarnings("resource")
public ChunkedCipherInputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException {
    DocumentInputStream dis = dir.createDocumentInputStream(DEFAULT_POIFS_ENTRY);
    length = dis.readLong();
    return new BinaryRC4CipherInputStream(dis, length);
}
Also used : DocumentInputStream(org.apache.poi.poifs.filesystem.DocumentInputStream)

Aggregations

DocumentInputStream (org.apache.poi.poifs.filesystem.DocumentInputStream)22 IOException (java.io.IOException)10 DocumentEntry (org.apache.poi.poifs.filesystem.DocumentEntry)5 DocumentNode (org.apache.poi.poifs.filesystem.DocumentNode)5 InputStream (java.io.InputStream)4 DocumentSummaryInformation (org.apache.poi.hpsf.DocumentSummaryInformation)4 PropertySet (org.apache.poi.hpsf.PropertySet)4 DirectoryNode (org.apache.poi.poifs.filesystem.DirectoryNode)4 Entry (org.apache.poi.poifs.filesystem.Entry)4 FileNotFoundException (java.io.FileNotFoundException)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 SummaryInformation (org.apache.poi.hpsf.SummaryInformation)2 DirectoryEntry (org.apache.poi.poifs.filesystem.DirectoryEntry)2 BoundedInputStream (org.apache.poi.util.BoundedInputStream)2 RLEDecompressingInputStream (org.apache.poi.util.RLEDecompressingInputStream)2 TikaException (org.apache.tika.exception.TikaException)2 EOFException (java.io.EOFException)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1