Top Description Fields Constructors Methods
org.apache.pdfbox.preflight.content

public Class StubOperator

extends OperatorProcessor
Class Inheritance
Static Imports
org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_ARRAY_TOO_LONG, .PreflightConstants.ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT, .PreflightConstants.ERROR_SYNTAX_LITERAL_TOO_LONG, .PreflightConstants.ERROR_SYNTAX_NAME_TOO_LONG, .PreflightConstants.ERROR_SYNTAX_NUMERIC_RANGE, .PreflightConstants.ERROR_SYNTAX_TOO_MANY_ENTRIES, .PreflightConstants.MAX_ARRAY_ELEMENTS, .PreflightConstants.MAX_DICT_ENTRIES, .PreflightConstants.MAX_NAME_SIZE, .PreflightConstants.MAX_NEGATIVE_FLOAT, .PreflightConstants.MAX_POSITIVE_FLOAT, .PreflightConstants.MAX_STRING_LENGTH

This implementation of OperatorProcessor allow the operator validation according PDF/A rules without compute the operator actions.

Field Summary

Modifier and TypeField and Description
private static final List<String>
private static final List<String>
private static final List<String>
private static final List<String>
private static final List<String>
private static final List<String>
private static final List<String>
private static final List<String>
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
checkArrayOperands(List<COSBase> arguments, int length)

If the arguments list of Operator doesn't have Array parameter, this method throws a ContentStreamException.

private void
checkNoOperands(List<COSBase> arguments)

If the arguments list of Operator isn't empty, this method throws a ContentStreamException.

private void
checkNumberOperands(List<COSBase>
the arguments list to check
arguments
,
int
the expected size of the list
length
)

If the arguments list of Operator doesn't have Number parameters (Int, float...), this method throws a ContentStreamException.

private void
checkStringOperands(List<COSBase> arguments, int length)

If the arguments list of Operator doesn't have String parameter, this method throws a ContentStreamException.

private void
checkTagAndPropertyOperands(List<COSBase> arguments)

The given arguments list is valid only if the first argument is a Tag (A String) and if the second argument is a String or a Dictionary

private ContentStreamException

Returns:

the ContentStreamException created.
createInvalidArgumentsError
()

Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.

private ContentStreamException

Returns:

the ContentStreamException created.
createLimitError
(String errorCode, String details)

Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.

public String
getName()

Implements abstract org.apache.pdfbox.contentstream.operator.OperatorProcessor.getName.

Returns the name of this operator, e.g. "BI".

public void
process(Operator
the operator to process
operator
,
List<COSBase>
the operands to use when processing
arguments
)

Implements abstract org.apache.pdfbox.contentstream.operator.OperatorProcessor.process.

Process the operator.

Inherited from org.apache.pdfbox.contentstream.operator.OperatorProcessor:
checkArrayTypesClassgetContext

Field Detail

CHECK_ARRAY_OPERANDSback to summary
private static final List<String> CHECK_ARRAY_OPERANDS
CHECK_NO_OPERANDSback to summary
private static final List<String> CHECK_NO_OPERANDS
CHECK_NUMBER_OPERANDSback to summary
private static final List<String> CHECK_NUMBER_OPERANDS
CHECK_NUMBER_OPERANDS_2back to summary
private static final List<String> CHECK_NUMBER_OPERANDS_2
CHECK_NUMBER_OPERANDS_4back to summary
private static final List<String> CHECK_NUMBER_OPERANDS_4
CHECK_NUMBER_OPERANDS_6back to summary
private static final List<String> CHECK_NUMBER_OPERANDS_6
CHECK_STRING_OPERANDSback to summary
private static final List<String> CHECK_STRING_OPERANDS
CHECK_TAG_AND_PROPERTY_OPERANDSback to summary
private static final List<String> CHECK_TAG_AND_PROPERTY_OPERANDS
nameback to summary
private final String name

Constructor Detail

StubOperatorback to summary
public StubOperator(PDFStreamEngine context, String name)

Method Detail

checkArrayOperandsback to summary
private void checkArrayOperands(List<COSBase> arguments, int length) throws ContentStreamException

If the arguments list of Operator doesn't have Array parameter, this method throws a ContentStreamException.

checkNoOperandsback to summary
private void checkNoOperands(List<COSBase> arguments) throws ContentStreamException

If the arguments list of Operator isn't empty, this method throws a ContentStreamException.

checkNumberOperandsback to summary
private void checkNumberOperands(List<COSBase> arguments, int length) throws ContentStreamException

If the arguments list of Operator doesn't have Number parameters (Int, float...), this method throws a ContentStreamException.

Parameters
arguments:List<COSBase>

the arguments list to check

length:int

the expected size of the list

checkStringOperandsback to summary
private void checkStringOperands(List<COSBase> arguments, int length) throws ContentStreamException

If the arguments list of Operator doesn't have String parameter, this method throws a ContentStreamException.

checkTagAndPropertyOperandsback to summary
private void checkTagAndPropertyOperands(List<COSBase> arguments) throws ContentStreamException

The given arguments list is valid only if the first argument is a Tag (A String) and if the second argument is a String or a Dictionary

createInvalidArgumentsErrorback to summary
private ContentStreamException createInvalidArgumentsError()

Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.

Returns:ContentStreamException

the ContentStreamException created.

createLimitErrorback to summary
private ContentStreamException createLimitError(String errorCode, String details)

Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.

Returns:ContentStreamException

the ContentStreamException created.

getNameback to summary
public String getName()

Implements abstract org.apache.pdfbox.contentstream.operator.OperatorProcessor.getName.

Doc from org.apache.pdfbox.contentstream.operator.OperatorProcessor.getName.

Returns the name of this operator, e.g. "BI".

Returns:String

the name of the operator

Annotations
@Override
processback to summary
public void process(Operator operator, List<COSBase> arguments) throws IOException

Implements abstract org.apache.pdfbox.contentstream.operator.OperatorProcessor.process.

Doc from org.apache.pdfbox.contentstream.operator.OperatorProcessor.process.

Process the operator.

Parameters
operator:Operator

the operator to process

arguments:List<COSBase>

the operands to use when processing

Annotations
@Override
Exceptions
IOException:
if the operator cannot be processed