Example usage for org.apache.pdfbox.cos COSNull NULL

List of usage examples for org.apache.pdfbox.cos COSNull NULL

Introduction

In this page you can find the example usage for org.apache.pdfbox.cos COSNull NULL.

Prototype

COSNull NULL

To view the source code for org.apache.pdfbox.cos COSNull NULL.

Click Source Link

Document

The one null object in the system.

Usage

From source file:com.aaasec.sigserv.csspsupport.pdfbox.modifications.CsCOSWriter.java

License:Apache License

/**
 * visitFromArray method comment.//from  w w w  .java  2s. co  m
 *
 * @param obj The object that is being visited.
 *
 * @throws COSVisitorException If there is an exception while visiting this
 * object.
 *
 * @return null
 */
public Object visitFromArray(COSArray obj) throws COSVisitorException {
    try {
        int count = 0;
        getStandardOutput().write(ARRAY_OPEN);
        for (Iterator<COSBase> i = obj.iterator(); i.hasNext();) {
            COSBase current = i.next();
            if (current instanceof COSDictionary) {
                addObjectToWrite(current);
                writeReference(current);
            } else if (current instanceof COSObject) {
                COSBase subValue = ((COSObject) current).getObject();
                if (subValue instanceof COSDictionary || subValue == null) {
                    addObjectToWrite(current);
                    writeReference(current);
                } else {
                    subValue.accept(this);
                }
            } else if (current == null) {
                COSNull.NULL.accept(this);
            } else if (current instanceof COSString) {
                COSString copy = new COSString(((COSString) current).getString());
                copy.accept(this);
            } else {
                current.accept(this);
            }
            count++;
            if (i.hasNext()) {
                if (count % 10 == 0) {
                    getStandardOutput().writeEOL();
                } else {
                    getStandardOutput().write(SPACE);
                }
            }
        }
        getStandardOutput().write(ARRAY_CLOSE);
        getStandardOutput().writeEOL();
        return null;
    } catch (IOException e) {
        throw new COSVisitorException(e);
    }
}