Class StubOperator
- java.lang.Object
-
- org.apache.pdfbox.contentstream.operator.OperatorProcessor
-
- org.apache.pdfbox.preflight.content.StubOperator
-
public class StubOperator extends OperatorProcessor
This implementation of OperatorProcessor allow the operator validation according PDF/A rules without compute the operator actions.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<java.lang.String>
CHECK_ARRAY_OPERANDS
private static java.util.List<java.lang.String>
CHECK_NO_OPERANDS
private static java.util.List<java.lang.String>
CHECK_NUMBER_OPERANDS
private static java.util.List<java.lang.String>
CHECK_NUMBER_OPERANDS_2
private static java.util.List<java.lang.String>
CHECK_NUMBER_OPERANDS_4
private static java.util.List<java.lang.String>
CHECK_NUMBER_OPERANDS_6
private static java.util.List<java.lang.String>
CHECK_STRING_OPERANDS
private static java.util.List<java.lang.String>
CHECK_TAG_AND_PROPERTY_OPERANDS
private java.lang.String
name
-
Fields inherited from class org.apache.pdfbox.contentstream.operator.OperatorProcessor
context
-
-
Constructor Summary
Constructors Constructor Description StubOperator(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkArrayOperands(java.util.List<COSBase> arguments, int length)
If the arguments list of Operator doesn't have Array parameter, this method throws a ContentStreamException.private void
checkNoOperands(java.util.List<COSBase> arguments)
If the arguments list of Operator isn't empty, this method throws a ContentStreamException.private void
checkNumberOperands(java.util.List<COSBase> arguments, int length)
If the arguments list of Operator doesn't have Number parameters (Int, float...), this method throws a ContentStreamException.private void
checkStringOperands(java.util.List<COSBase> arguments, int length)
If the arguments list of Operator doesn't have String parameter, this method throws a ContentStreamException.private void
checkTagAndPropertyOperands(java.util.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 Dictionaryprivate ContentStreamException
createInvalidArgumentsError()
Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.private ContentStreamException
createLimitError(java.lang.String errorCode, java.lang.String details)
Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.java.lang.String
getName()
Returns the name of this operator, e.g.void
process(Operator operator, java.util.List<COSBase> arguments)
Process the operator.-
Methods inherited from class org.apache.pdfbox.contentstream.operator.OperatorProcessor
checkArrayTypesClass, getContext, setContext
-
-
-
-
Field Detail
-
name
private final java.lang.String name
-
CHECK_NO_OPERANDS
private static final java.util.List<java.lang.String> CHECK_NO_OPERANDS
-
CHECK_STRING_OPERANDS
private static final java.util.List<java.lang.String> CHECK_STRING_OPERANDS
-
CHECK_TAG_AND_PROPERTY_OPERANDS
private static final java.util.List<java.lang.String> CHECK_TAG_AND_PROPERTY_OPERANDS
-
CHECK_NUMBER_OPERANDS_6
private static final java.util.List<java.lang.String> CHECK_NUMBER_OPERANDS_6
-
CHECK_NUMBER_OPERANDS_4
private static final java.util.List<java.lang.String> CHECK_NUMBER_OPERANDS_4
-
CHECK_NUMBER_OPERANDS_2
private static final java.util.List<java.lang.String> CHECK_NUMBER_OPERANDS_2
-
CHECK_NUMBER_OPERANDS
private static final java.util.List<java.lang.String> CHECK_NUMBER_OPERANDS
-
CHECK_ARRAY_OPERANDS
private static final java.util.List<java.lang.String> CHECK_ARRAY_OPERANDS
-
-
Method Detail
-
process
public void process(Operator operator, java.util.List<COSBase> arguments) throws java.io.IOException
Description copied from class:OperatorProcessor
Process the operator.- Specified by:
process
in classOperatorProcessor
- Parameters:
operator
- the operator to processarguments
- the operands to use when processing- Throws:
java.io.IOException
- if the operator cannot be processed
-
checkNoOperands
private void checkNoOperands(java.util.List<COSBase> arguments) throws ContentStreamException
If the arguments list of Operator isn't empty, this method throws a ContentStreamException.- Parameters:
arguments
-- Throws:
ContentStreamException
-
checkStringOperands
private void checkStringOperands(java.util.List<COSBase> arguments, int length) throws ContentStreamException
If the arguments list of Operator doesn't have String parameter, this method throws a ContentStreamException.- Parameters:
arguments
-length
-- Throws:
ContentStreamException
-
checkArrayOperands
private void checkArrayOperands(java.util.List<COSBase> arguments, int length) throws ContentStreamException
If the arguments list of Operator doesn't have Array parameter, this method throws a ContentStreamException.- Parameters:
arguments
-length
-- Throws:
ContentStreamException
-
checkNumberOperands
private void checkNumberOperands(java.util.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
- the arguments list to checklength
- the expected size of the list- Throws:
ContentStreamException
-
checkTagAndPropertyOperands
private void checkTagAndPropertyOperands(java.util.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- Parameters:
arguments
-- Throws:
ContentStreamException
-
createInvalidArgumentsError
private ContentStreamException createInvalidArgumentsError()
Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.- Returns:
- the ContentStreamException created.
-
createLimitError
private ContentStreamException createLimitError(java.lang.String errorCode, java.lang.String details)
Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.- Returns:
- the ContentStreamException created.
-
getName
public java.lang.String getName()
Description copied from class:OperatorProcessor
Returns the name of this operator, e.g. "BI".- Specified by:
getName
in classOperatorProcessor
-
-