org.icepdf.core.util.content
Interface ContentParser

All Known Implementing Classes:
AbstractContentParser, OContentParser

public interface ContentParser

ContentParser interface for content streams.

Since:
5.0

Method Summary
 GraphicsState getGraphicsState()
          Gets the graphic state object associated with the parser.
 Shapes getShapes()
          Gets the shapes parsed by the last run of parse.
 java.util.Stack<java.lang.Object> getStack()
          Gets the stack used by the content parser.
 ContentParser parse(byte[][] streamBytes)
          Parse the given stream bytes.
 Shapes parseTextBlocks(byte[][] source)
          Optimized text parsing call which will ignore any instructions that are not related to text extraction.
 void setGlyph2UserSpaceScale(float scale)
          Sets the scale factor used by some graphic state parameters so that the to users space CTM scale factor can be applied.
 void setGraphicsState(GraphicsState graphicState)
          Sets the external graphics state object associated with Form's and Tiling Patterns.
 

Method Detail

getShapes

Shapes getShapes()
Gets the shapes parsed by the last run of parse.

Returns:
Shapes associated with the content parser.

getStack

java.util.Stack<java.lang.Object> getStack()
Gets the stack used by the content parser. Under normal execution the stack should be empty. If the stack has elements remaining then is generally means that a content parsing error has taken place.

Returns:
object stack.

getGraphicsState

GraphicsState getGraphicsState()
Gets the graphic state object associated with the parser. Needed by the Type3 font program.

Returns:
graphic state of the parsed content stream.

setGraphicsState

void setGraphicsState(GraphicsState graphicState)
Sets the external graphics state object associated with Form's and Tiling Patterns.

Parameters:
graphicState - graphic state to pass to parser.

parse

ContentParser parse(byte[][] streamBytes)
                    throws java.lang.InterruptedException,
                           java.io.IOException
Parse the given stream bytes.

Parameters:
streamBytes - bytes that make of one or more content streams.
Returns:
an instance of this content parser.
Throws:
java.lang.InterruptedException - thread was interrupted.
java.io.IOException - io exception during the pars.

parseTextBlocks

Shapes parseTextBlocks(byte[][] source)
                       throws java.io.UnsupportedEncodingException
Optimized text parsing call which will ignore any instructions that are not related to text extraction. Images and other operands are ignored speeding up the extraction process.

Parameters:
source - byte source to parse.
Returns:
Shapes object which contains the extract PageText object.
Throws:
java.io.UnsupportedEncodingException - encoding error.

setGlyph2UserSpaceScale

void setGlyph2UserSpaceScale(float scale)
Sets the scale factor used by some graphic state parameters so that the to users space CTM scale factor can be applied. In particular some Type3 glyphs need to take into account this scaling factor.

Parameters:
scale - scale factor to apply to various graphic state parameters.