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 SeekableInputStreamsource
-
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 voidappendToToken(int ch)protected voidclearToken()voidcloseInputStream()protected booleanfindKeyword(Token.Keyword keyword)protected booleanfindKeyword(Token.Keyword keyword, int lookUpSize)protected StringgetLine()protected StringgetLine(int offset)protected byte[]getLineBytes()ASInputStreamgetRandomAccess(long length)static byte[]getRawBytes(String string)protected TokengetToken()protected voidinitializeToken()protected static booleanisCR(int c)protected booleanisDigit()protected static booleanisDigit(byte c)protected booleanisEOL(byte ch)protected static booleanisFF(int c)protected static booleanisHexDigit(byte ch)protected static booleanisLF(int c)protected booleanisNextByteEOL()protected voidnextLine()protected voidnextToken()protected voidreadName()protected voidreadNumber()protected StringreadUntilDelimiter()protected voidskipExpectedCharacter(char exp)protected voidskipSingleEol()protected voidskipSingleSpace()protected booleanskipSingleSpace(boolean skipComment)protected voidskipSpaces()protected voidskipSpaces(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
-
-