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_OPERANDSprivate static java.util.List<java.lang.String>CHECK_NO_OPERANDSprivate static java.util.List<java.lang.String>CHECK_NUMBER_OPERANDSprivate static java.util.List<java.lang.String>CHECK_NUMBER_OPERANDS_2private static java.util.List<java.lang.String>CHECK_NUMBER_OPERANDS_4private static java.util.List<java.lang.String>CHECK_NUMBER_OPERANDS_6private static java.util.List<java.lang.String>CHECK_STRING_OPERANDSprivate static java.util.List<java.lang.String>CHECK_TAG_AND_PROPERTY_OPERANDSprivate java.lang.Stringname
-
Constructor Summary
Constructors Constructor Description StubOperator(PDFStreamEngine context, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckArrayOperands(java.util.List<COSBase> arguments, int length)If the arguments list of Operator doesn't have Array parameter, this method throws a ContentStreamException.private voidcheckNoOperands(java.util.List<COSBase> arguments)If the arguments list of Operator isn't empty, this method throws a ContentStreamException.private voidcheckNumberOperands(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 voidcheckStringOperands(java.util.List<COSBase> arguments, int length)If the arguments list of Operator doesn't have String parameter, this method throws a ContentStreamException.private voidcheckTagAndPropertyOperands(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 ContentStreamExceptioncreateInvalidArgumentsError()Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.private ContentStreamExceptioncreateLimitError(java.lang.String errorCode, java.lang.String details)Create a ContentStreamException with ERROR_SYNTAX_CONTENT_STREAM_INVALID_ARGUMENT.java.lang.StringgetName()Returns the name of this operator, e.g.voidprocess(Operator operator, java.util.List<COSBase> arguments)Process the operator.-
Methods inherited from class org.apache.pdfbox.contentstream.operator.OperatorProcessor
checkArrayTypesClass, getContext
-
-
-
-
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
-
-
Constructor Detail
-
StubOperator
public StubOperator(PDFStreamEngine context, java.lang.String name)
-
-
Method Detail
-
process
public void process(Operator operator, java.util.List<COSBase> arguments) throws java.io.IOException
Description copied from class:OperatorProcessorProcess the operator.- Specified by:
processin 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:OperatorProcessorReturns the name of this operator, e.g. "BI".- Specified by:
getNamein classOperatorProcessor- Returns:
- the name of the operator
-
-