Package org.verapdf.parser
Class BaseParser
- java.lang.Object
-
- org.verapdf.parser.BaseParser
-
- Direct Known Subclasses:
AFMParser
,COSParser
,FunctionParser
public class BaseParser extends Object
- Author:
- Timur Kamalov
-
-
Field Summary
Fields Modifier and Type Field Description protected SeekableInputStream
source
-
Constructor Summary
Constructors Constructor Description BaseParser(InputStream fileStream)
BaseParser(String fileName)
BaseParser(SeekableInputStream stream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendToToken(int ch)
protected void
clearToken()
void
closeInputStream()
protected boolean
findKeyword(Token.Keyword keyword)
protected boolean
findKeyword(Token.Keyword keyword, int lookUpSize)
protected String
getLine()
protected String
getLine(int offset)
protected byte[]
getLineBytes()
ASInputStream
getRandomAccess(long length)
static byte[]
getRawBytes(String string)
protected Token
getToken()
protected void
initializeToken()
protected static boolean
isCR(int c)
protected boolean
isDigit()
protected static boolean
isDigit(byte c)
protected boolean
isEOL(byte ch)
protected static boolean
isFF(int c)
protected static boolean
isHexDigit(byte ch)
protected static boolean
isLF(int c)
protected boolean
isNextByteEOL()
protected void
nextLine()
protected void
nextToken()
protected void
readName()
protected void
readNumber()
protected String
readUntilDelimiter()
protected void
skipExpectedCharacter(char exp)
protected void
skipSingleEol()
protected void
skipSingleSpace()
protected boolean
skipSingleSpace(boolean skipComment)
protected void
skipSpaces()
protected void
skipSpaces(boolean skipComment)
-
-
-
Field Detail
-
source
protected SeekableInputStream source
-
-
Constructor Detail
-
BaseParser
public BaseParser(SeekableInputStream stream) throws IOException
- Throws:
IOException
-
BaseParser
public BaseParser(String fileName) throws IOException
- Throws:
IOException
-
BaseParser
public BaseParser(InputStream fileStream) throws IOException
- Throws:
IOException
-
-
Method Detail
-
closeInputStream
public void closeInputStream() throws IOException
- Throws:
IOException
-
getToken
protected Token getToken()
-
getLine
protected String getLine() throws IOException
- Throws:
IOException
-
getLineBytes
protected byte[] getLineBytes() throws IOException
- Throws:
IOException
-
getLine
protected String getLine(int offset) throws IOException
- Throws:
IOException
-
readUntilDelimiter
protected String readUntilDelimiter() throws IOException
- Throws:
IOException
-
findKeyword
protected boolean findKeyword(Token.Keyword keyword) throws IOException
- Throws:
IOException
-
findKeyword
protected boolean findKeyword(Token.Keyword keyword, int lookUpSize) throws IOException
- Throws:
IOException
-
nextToken
protected void nextToken() throws IOException
- Throws:
IOException
-
getRandomAccess
public ASInputStream getRandomAccess(long length) throws IOException
- Throws:
IOException
-
isNextByteEOL
protected boolean isNextByteEOL() throws IOException
- Throws:
IOException
-
skipSingleEol
protected void skipSingleEol() throws IOException
- Throws:
IOException
-
skipSpaces
protected void skipSpaces() throws IOException
- Throws:
IOException
-
skipSingleSpace
protected void skipSingleSpace() throws IOException
- Throws:
IOException
-
skipSpaces
protected void skipSpaces(boolean skipComment) throws IOException
- Throws:
IOException
-
skipSingleSpace
protected boolean skipSingleSpace(boolean skipComment) throws IOException
- Throws:
IOException
-
isDigit
protected boolean isDigit() throws IOException
- Throws:
IOException
-
isDigit
protected static boolean isDigit(byte c)
-
isHexDigit
protected static boolean isHexDigit(byte ch)
-
isLF
protected static boolean isLF(int c)
-
isCR
protected static boolean isCR(int c)
-
isFF
protected static boolean isFF(int c)
-
nextLine
protected void nextLine() throws IOException
- Throws:
IOException
-
isEOL
protected boolean isEOL(byte ch) throws IOException
- Throws:
IOException
-
readName
protected void readName() throws IOException
- Throws:
IOException
-
readNumber
protected void readNumber() throws IOException
- Throws:
IOException
-
initializeToken
protected void initializeToken()
-
clearToken
protected void clearToken()
-
appendToToken
protected void appendToToken(int ch)
-
getRawBytes
public static byte[] getRawBytes(String string)
-
skipExpectedCharacter
protected void skipExpectedCharacter(char exp) throws IOException
- Throws:
IOException
-
-