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

public final Class Parser

extends Object
Class Inheritance

Parser for PDF Type 4 functions. This implements a small subset of the PostScript language but is no full PostScript interpreter.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
Parser.AbstractSyntaxHandler

Abstract base class for a SyntaxHandler.

private static enum
Parser.State

Used to indicate the parsers current state.

public static interface
Parser.SyntaxHandler

This interface defines all possible syntactic elements of a Type 4 function.

private static class
Parser.Tokenizer

Tokenizer for Type 4 functions.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
parse(CharSequence
the text source
input
,
Parser.SyntaxHandler
the syntax handler
handler
)

Parses a Type 4 function and sends the syntactic elements to the given syntax handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Parserback to summary
private Parser()

Method Detail

parseback to summary
public static void parse(CharSequence input, Parser.SyntaxHandler handler)

Parses a Type 4 function and sends the syntactic elements to the given syntax handler.

Parameters
input:CharSequence

the text source

handler:Parser.SyntaxHandler

the syntax handler

org.apache.pdfbox.pdmodel.common.function.type4 back to summary

public abstract Class Parser.AbstractSyntaxHandler

extends Object
implements SyntaxHandler
Class Inheritance
  • java.lang.Object
  • org.apache.pdfbox.pdmodel.common.function.type4.Parser.AbstractSyntaxHandler
All Implemented Interfaces
org.apache.pdfbox.pdmodel.common.function.type4.Parser.SyntaxHandler
Known Direct Subclasses
org.apache.pdfbox.pdmodel.common.function.type4.InstructionSequenceBuilder

Abstract base class for a SyntaxHandler.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
newLine(CharSequence
the new line character (CR, LF, CR/LF or FF)
text
)

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

Indicates that a new line starts.

public void
whitespace(CharSequence
the whitespace text
text
)

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

Called when whitespace characters are encountered.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractSyntaxHandlerback to summary
public AbstractSyntaxHandler()

Method Detail

commentback to summary
public void comment(CharSequence text)

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

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

Called for a comment.

Parameters
text:CharSequence

the comment

Annotations
@Override
newLineback to summary
public void newLine(CharSequence text)

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

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

Indicates that a new line starts.

Parameters
text:CharSequence

the new line character (CR, LF, CR/LF or FF)

Annotations
@Override
whitespaceback to summary
public void whitespace(CharSequence text)

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

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

Called when whitespace characters are encountered.

Parameters
text:CharSequence

the whitespace text

Annotations
@Override
org.apache.pdfbox.pdmodel.common.function.type4 back to summary

private final Enum Parser.State

extends Enum<Parser.State>
Class Inheritance

Used to indicate the parsers current state.

Field Summary

Modifier and TypeField and Description
public static final Parser.State
public static final Parser.State
public static final Parser.State
public static final Parser.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Parser.State
public static Parser.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COMMENTback to summary
public static final Parser.State COMMENT
NEWLINEback to summary
public static final Parser.State NEWLINE
TOKENback to summary
public static final Parser.State TOKEN
WHITESPACEback to summary
public static final Parser.State WHITESPACE

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static Parser.State valueOf(String name)
valuesback to summary
public static Parser.State[] values()
org.apache.pdfbox.pdmodel.common.function.type4 back to summary

public Interface Parser.SyntaxHandler

Known Direct Implementers
org.apache.pdfbox.pdmodel.common.function.type4.Parser.AbstractSyntaxHandler

This interface defines all possible syntactic elements of a Type 4 function. It is called by the parser as the function is interpreted.

Method Summary

Modifier and TypeMethod and Description
public void
comment(CharSequence
the comment
text
)

Called for a comment.

public void
newLine(CharSequence
the new line character (CR, LF, CR/LF or FF)
text
)

Indicates that a new line starts.

public void
token(CharSequence
the token text
text
)

Called when a token is encountered.

public void
whitespace(CharSequence
the whitespace text
text
)

Called when whitespace characters are encountered.

Method Detail

commentback to summary
public void comment(CharSequence text)

Called for a comment.

Parameters
text:CharSequence

the comment

newLineback to summary
public void newLine(CharSequence text)

Indicates that a new line starts.

Parameters
text:CharSequence

the new line character (CR, LF, CR/LF or FF)

tokenback to summary
public void token(CharSequence text)

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

Parameters
text:CharSequence

the token text

whitespaceback to summary
public void whitespace(CharSequence text)

Called when whitespace characters are encountered.

Parameters
text:CharSequence

the whitespace text

org.apache.pdfbox.pdmodel.common.function.type4 back to summary

private final Class Parser.Tokenizer

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.pdfbox.pdmodel.common.function.type4.Parser.Tokenizer

Tokenizer for Type 4 functions.

Field Summary

Modifier and TypeField and Description
private final StringBuilder
private static final char
private static final char
private static final char
private final Parser.SyntaxHandler
private int
private final CharSequence
private static final char
private static final char
private static final char
private Parser.State
private static final char

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private char
private boolean
private char
private Parser.State
private char
peek()

private void
private void
private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final StringBuilder buffer
CRback to summary
private static final char CR
EOTback to summary
private static final char EOT
FFback to summary
private static final char FF
handlerback to summary
private final Parser.SyntaxHandler handler
indexback to summary
private int index
inputback to summary
private final CharSequence input
LFback to summary
private static final char LF
NULback to summary
private static final char NUL
SPACEback to summary
private static final char SPACE
stateback to summary
private Parser.State state
TABback to summary
private static final char TAB

Constructor Detail

Tokenizerback to summary
private Tokenizer(CharSequence text, Parser.SyntaxHandler syntaxHandler)

Method Detail

currentCharback to summary
private char currentChar()
hasMoreback to summary
private boolean hasMore()
nextCharback to summary
private char nextChar()
nextStateback to summary
private Parser.State nextState()
peekback to summary
private char peek()
scanCommentback to summary
private void scanComment()
scanNewLineback to summary
private void scanNewLine()
scanTokenback to summary
private void scanToken()
scanWhitespaceback to summary
private void scanWhitespace()
tokenizeback to summary
private void tokenize()