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

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

Introduction

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

Prototype

int INDIRECT

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

Click Source Link

Document

A possible type of 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) ' ');
        }/* w  w w  .ja  va 2s  . c  om*/
        return allBytes.toByteArray();
    default:
        throw new IllegalStateException("No se soporta contenido del tipo: " + contentObject.getClass()); //$NON-NLS-1$
    }
}