org.apache.pdfbox.preflight.content

## Class PreflightStreamEngine

- java.lang.Object
- - org.apache.pdfbox.contentstream.PDFStreamEngine
  - - org.apache.pdfbox.preflight.content.PreflightStreamEngine

Direct Known Subclasses:
  PreflightContentStream, PreflightType3Stream

    public abstract class PreflightStreamEngine
    extends org.apache.pdfbox.contentstream.PDFStreamEngine

This class inherits from org.apache.pdfbox.util.PDFStreamEngine to allow the validation of specific rules in ContentStream.

### Field Summary

Fields
`protected PreflightContext` `context`
`protected org.apache.pdfbox.pdmodel.PDPage` `processedPage`

### Constructor Summary

Constructors
Constructor and Description
`PreflightStreamEngine(PreflightContext context, org.apache.pdfbox.pdmodel.PDPage page)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `checkColorOperators(String operation)` This method validates if the ColorOperator can be used with the color space defined in OutputIntent dictionaries.
`protected void` `checkSetColorSpaceOperators(org.apache.pdfbox.contentstream.operator.Operator operator, List<org.apache.pdfbox.cos.COSBase> arguments)` This method validates if the ColorSpace used as operand is consistent with the color space defined in OutputIntent dictionaries.
`protected void` `registerError(String msg, String errorCode)` Add a validation error into the PreflightContext
`protected void` `registerError(String msg, String errorCode, boolean warning)`
`void` `registerError(String msg, String errorCode, boolean warning, Throwable cause)`
`void` `registerError(String msg, String errorCode, Throwable cause)`
`protected void` `validateInlineImageColorSpace(org.apache.pdfbox.contentstream.operator.Operator operator)` This method validates if the ColorSpace used by the InlinedImage is consistent with the color space defined in OutputIntent dictionaries.
`protected void` `validateInlineImageFilter(org.apache.pdfbox.contentstream.operator.Operator operator)` Throw a ContentStreamException if the LZW filter is used in a InlinedImage.
`protected void` `validateNumberOfGraphicStates(org.apache.pdfbox.contentstream.operator.Operator operator)` Valid the number of graphic states if the operator is the Save Graphic state operator ("q")
`protected void` `validateRenderingIntent(org.apache.pdfbox.contentstream.operator.Operator operator, List<org.apache.pdfbox.cos.COSBase> arguments)` Check operands of the "ri" operator.

### Methods inherited from class org.apache.pdfbox.contentstream.PDFStreamEngine

`addOperator, applyTextAdjustment, beginMarkedContentSequence, beginText, decreaseLevel, endMarkedContentSequence, endText, getAppearance, getCurrentPage, getGraphicsStackSize, getGraphicsState, getInitialMatrix, getLevel, getResources, getTextLineMatrix, getTextMatrix, increaseLevel, isShouldProcessColorOperators, markedContentPoint, operatorException, processAnnotation, processChildStream, processOperator, processOperator, processPage, processSoftMask, processTilingPattern, processTilingPattern, processTransparencyGroup, processType3Stream, restoreGraphicsStack, restoreGraphicsState, saveGraphicsStack, saveGraphicsState, setLineDashPattern, setTextLineMatrix, setTextMatrix, showAnnotation, showFontGlyph, showForm, showGlyph, showText, showTextString, showTextStrings, showTransparencyGroup, showType3Glyph, transformedPoint, transformWidth, unsupportedOperator`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### context

    protected PreflightContext context

#### processedPage

    protected org.apache.pdfbox.pdmodel.PDPage processedPage

### Constructor Detail

#### PreflightStreamEngine

    public PreflightStreamEngine(PreflightContext context,
                                 org.apache.pdfbox.pdmodel.PDPage page)

### Method Detail

#### validateRenderingIntent

    protected void validateRenderingIntent(org.apache.pdfbox.contentstream.operator.Operator operator,
                                           List<org.apache.pdfbox.cos.COSBase> arguments)
                                    throws ContentStreamException

Check operands of the "ri" operator. Operands must exist in the RenderingIntent list. (org.apache.pdfbox.preflight.utils.RenderingIntents)

Parameters:
  `operator` - the "ri" operator
  `arguments` - the "ri" operands
Throws:
  `ContentStreamException` - ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY if the operand is invalid

#### validateNumberOfGraphicStates

    protected void validateNumberOfGraphicStates(org.apache.pdfbox.contentstream.operator.Operator operator)

Valid the number of graphic states if the operator is the Save Graphic state operator ("q")

Parameters:
  `operator` -

#### validateInlineImageFilter

    protected void validateInlineImageFilter(org.apache.pdfbox.contentstream.operator.Operator operator)

Throw a ContentStreamException if the LZW filter is used in a InlinedImage.

Parameters:
  `operator` - the InlinedImage object (BI to EI)

#### validateInlineImageColorSpace

    protected void validateInlineImageColorSpace(org.apache.pdfbox.contentstream.operator.Operator operator)
                                          throws IOException

This method validates if the ColorSpace used by the InlinedImage is consistent with the color space defined in OutputIntent dictionaries.

Parameters:
  `operator` - the InlinedImage object (BI to EI)
Throws:
  `IOException`

#### checkColorOperators

    protected void checkColorOperators(String operation)
                                throws ContentStreamException

This method validates if the ColorOperator can be used with the color space defined in OutputIntent dictionaries.

Parameters:
  `operation` - the color operator
Throws:
  `ContentStreamException`

#### checkSetColorSpaceOperators

    protected void checkSetColorSpaceOperators(org.apache.pdfbox.contentstream.operator.Operator operator,
                                               List<org.apache.pdfbox.cos.COSBase> arguments)
                                        throws IOException

This method validates if the ColorSpace used as operand is consistent with the color space defined in OutputIntent dictionaries.

Parameters:
  `operator` -
  `arguments` -
Throws:
  `IOException`

#### registerError

    protected void registerError(String msg,
                                 String errorCode)

Add a validation error into the PreflightContext

Parameters:
  `msg` - exception details
  `errorCode` - the error code.

#### registerError

    public void registerError(String msg,
                              String errorCode,
                              Throwable cause)

#### registerError

    protected void registerError(String msg,
                                 String errorCode,
                                 boolean warning)

#### registerError

    public void registerError(String msg,
                              String errorCode,
                              boolean warning,
                              Throwable cause)