Example usage for org.apache.pdfbox.cos COSStream containsKey

List of usage examples for org.apache.pdfbox.cos COSStream containsKey

Introduction

In this page you can find the example usage for org.apache.pdfbox.cos COSStream containsKey.

Prototype

public boolean containsKey(COSName name) 

Source Link

Usage

From source file:org.apache.fop.render.pdf.pdfbox.PDFBoxAdapter.java

License:Apache License

private Object readCOSStream(COSStream originalStream, Object keyBase) throws IOException {
    InputStream in;/*from   ww w  .j a  va2 s.c o  m*/
    Set filter;
    if (pdfDoc.isEncryptionActive() || (originalStream.containsKey(COSName.DECODE_PARMS)
            && !originalStream.containsKey(COSName.FILTER))) {
        in = originalStream.getUnfilteredStream();
        filter = FILTER_FILTER;
    } else {
        //transfer encoded data (don't reencode)
        in = originalStream.getFilteredStream();
        filter = Collections.EMPTY_SET;
    }
    PDFStream stream = new PDFStream();
    OutputStream out = stream.getBufferOutputStream();
    IOUtils.copyLarge(in, out);
    transferDict(originalStream, stream, filter);
    return cacheClonedObject(keyBase, stream);
}