Example usage for com.lowagie.text.pdf PdfObject type

List of usage examples for com.lowagie.text.pdf PdfObject type

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfObject type.

Prototype

int type

To view the source code for com.lowagie.text.pdf PdfObject type.

Click Source Link

Document

The type of this PdfObject

Usage

From source file:es.gob.afirma.signers.pades.ltv.PdfDocumentSecurityStore.java

License:Open Source License

private static byte[] getContentBytesFromContentObject(final PdfObject contentObject) throws IOException {
    switch (contentObject.type()) {
    case PdfObject.INDIRECT:
        return getContentBytesFromContentObject(PdfReader.getPdfObject(contentObject));
    case PdfObject.STREAM:
        return PdfReader.getStreamBytes((PRStream) PdfReader.getPdfObject(contentObject));
    case PdfObject.ARRAY:
        final ByteArrayOutputStream allBytes = new ByteArrayOutputStream();
        final ListIterator<PdfObject> iter = ((PdfArray) contentObject).listIterator();
        while (iter.hasNext()) {
            allBytes.write(getContentBytesFromContentObject(iter.next()));
            allBytes.write((byte) ' ');
        }/*from  w  w w. j  av a  2 s  .c  om*/
        return allBytes.toByteArray();
    default:
        throw new IllegalStateException("No se soporta contenido del tipo: " + contentObject.getClass()); //$NON-NLS-1$
    }
}