Package com.stardog.stark.io
Class IOParserContext
java.lang.Object
com.stardog.stark.io.AbstractRDFHandler
com.stardog.stark.io.ParserContext
com.stardog.stark.io.IOParserContext
- All Implemented Interfaces:
RDFHandler
- Direct Known Subclasses:
LineSupplierParserContext,TurtleParserContext
Extended parser state that wraps the stream to be parsed to provide common IO operations for most of the basic text RDF formats.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove, Arjohn Kampman
-
Nested Class Summary
Nested classes/interfaces inherited from class com.stardog.stark.io.ParserContext
ParserContext.ParseError -
Field Summary
Fields inherited from class com.stardog.stark.io.ParserContext
BNODE_ID_PREFIX, caseInsensitiveDirectives, mBaseIRI, mColumnNumber, mContext, mLineNumber, mNamespaces, mObject, mPredicate, mSubject -
Constructor Summary
ConstructorsConstructorDescriptionIOParserContext(Reader theReader, RDFHandler theHandler, Options theOptions) -
Method Summary
Modifier and TypeMethodDescriptionReset the buffer for parsing datatypes and return itRest the buffer that can be used for parsing language tags and return itintPeeks at the next Unicode code point without advancing the reader, and returns its value.intReads the next Unicode code point.resetSB()trimSB()voidunread(int theCodePoint) Pushes back a single code point by copying it to the front of the buffer.voidPushes back the supplied string by copying it to the front of the buffer.intverifyCharacterOrFail(char expected) intverifyCharacterOrFail(int codePoint, String expected) intverifyCharacterOrFail(String expected) Verifies that the supplied character code point codePoint is one of the expected characters specified in expected.Methods inherited from class com.stardog.stark.io.ParserContext
createBNode, createBNode, createLiteral, currentStatement, end, error, error, getRandomBnodeIdPrefix, handle, is, namespace, namespace, reportStatement, resetStatement, resolveURI, start
-
Constructor Details
-
IOParserContext
public IOParserContext(@Nonnull Reader theReader, @Nonnull RDFHandler theHandler, @Nonnull Options theOptions)
-
-
Method Details
-
langBuffer
Rest the buffer that can be used for parsing language tags and return it- Returns:
- the buffer
-
datatypeBuffer
Reset the buffer for parsing datatypes and return it- Returns:
- the buffer
-
resetSB
-
trimSB
-
peekCodePoint
Peeks at the next Unicode code point without advancing the reader, and returns its value.- Returns:
- the next Unicode code point, or -1 if the end of the stream has been reached.
- Throws:
IOException
-
readCodePoint
Reads the next Unicode code point.- Returns:
- the next Unicode code point, or -1 if the end of the stream has been reached.
- Throws:
IOException
-
unread
Pushes back a single code point by copying it to the front of the buffer. After this method returns, a call toreadCodePoint()will return the same code point c again.- Parameters:
theCodePoint- a single Unicode code point.- Throws:
IOException
-
unread
Pushes back the supplied string by copying it to the front of the buffer. After this method returns, successive calls toreadCodePoint()will return the code points in the supplied string again, starting at the first in the String..- Parameters:
theStr- the string to un-read.- Throws:
UncheckedIOException
-
verifyCharacterOrFail
Verifies that the supplied character code point codePoint is one of the expected characters specified in expected. This method will throw a ParseException if this is not the case.- Throws:
IOException
-
verifyCharacterOrFail
- Throws:
IOException
-
verifyCharacterOrFail
- Throws:
InvalidRDF
-