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

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

Introduction

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

Prototype

int ARRAY

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

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  ww  .  j a  va2s. c  o m*/
        return allBytes.toByteArray();
    default:
        throw new IllegalStateException("No se soporta contenido del tipo: " + contentObject.getClass()); //$NON-NLS-1$
    }
}