Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.common.function.type4

public final Class InstructionSequenceBuilder

extends AbstractSyntaxHandler
Class Inheritance
Imports
java.util.Stack, java.util.regex.Matcher, .Pattern

Basic parser for Type 4 functions which is used to build up instruction sequences.

Field Summary

Modifier and TypeField and Description
private static final Pattern
private final InstructionSequence
private static final Pattern
private final Stack<InstructionSequence>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private InstructionSequence
public InstructionSequence

Returns:

the instruction sequence
getInstructionSequence
()

Returns the instruction sequence that has been build from the syntactic elements.

public static InstructionSequence

Returns:

the instruction sequence
parse
(CharSequence
the Type 4 function text
text
)

Parses the given text into an instruction sequence representing a Type 4 function that can be executed.

public static int

Returns:

the parsed value
parseInt
(String
the token to be parsed
token
)

Parses a value of type "int".

public static float

Returns:

the parsed value
parseReal
(String
the token to be parsed
token
)

Parses a value of type "real".

public void
token(CharSequence
the token text
text
)

Implements org.apache.pdfbox.pdmodel.common.function.type4.Parser.SyntaxHandler.token.

Called when a token is encountered.

private void
token(String token)

Inherited from org.apache.pdfbox.pdmodel.common.function.type4.Parser.AbstractSyntaxHandler:
commentnewLinewhitespace

Field Detail

INTEGER_PATTERNback to summary
private static final Pattern INTEGER_PATTERN
mainSequenceback to summary
private final InstructionSequence mainSequence
REAL_PATTERNback to summary
private static final Pattern REAL_PATTERN
seqStackback to summary
private final Stack<InstructionSequence> seqStack

Constructor Detail

InstructionSequenceBuilderback to summary
private InstructionSequenceBuilder()

Method Detail

getCurrentSequenceback to summary
private InstructionSequence getCurrentSequence()
getInstructionSequenceback to summary
public InstructionSequence getInstructionSequence()

Returns the instruction sequence that has been build from the syntactic elements.

Returns:InstructionSequence

the instruction sequence

parseback to summary
public static InstructionSequence parse(CharSequence text)

Parses the given text into an instruction sequence representing a Type 4 function that can be executed.

Parameters
text:CharSequence

the Type 4 function text

Returns:InstructionSequence

the instruction sequence

parseIntback to summary
public static int parseInt(String token)

Parses a value of type "int".

Parameters
token:String

the token to be parsed

Returns:int

the parsed value

parseRealback to summary
public static float parseReal(String token)

Parses a value of type "real".

Parameters
token:String

the token to be parsed

Returns:float

the parsed value

tokenback to summary
public void token(CharSequence text)

Implements org.apache.pdfbox.pdmodel.common.function.type4.Parser.SyntaxHandler.token.

Doc from org.apache.pdfbox.pdmodel.common.function.type4.Parser.SyntaxHandler.token.

Called when a token is encountered. No distinction between operators and values is done here.

Parameters
text:CharSequence

the token text

Annotations
@Override
tokenback to summary
private void token(String token)