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`

public class IOParserContext extends ParserContext

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

  Constructors
  Constructor
  Description
  `IOParserContext(Reader theReader, RDFHandler theHandler, Options theOptions)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `StringBuilder`
  `datatypeBuffer()`
  Reset the buffer for parsing datatypes and return it
  `StringBuilder`
  `langBuffer()`
  Rest the buffer that can be used for parsing language tags and return it
  `int`
  `peekCodePoint()`
  Peeks at the next Unicode code point without advancing the reader, and returns its value.
  `int`
  `readCodePoint()`
  Reads the next Unicode code point.
  `StringBuilder`
  `resetSB()`
  `StringBuilder`
  `trimSB()`
  `void`
  `unread(int theCodePoint)`
  Pushes back a single code point by copying it to the front of the buffer.
  `void`
  `unread(String theStr)`
  Pushes back the supplied string by copying it to the front of the buffer.
  `int`
  `verifyCharacterOrFail(char expected)`
  `int`
  `verifyCharacterOrFail(int codePoint, String expected)`
  `int`
  `verifyCharacterOrFail(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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### IOParserContext

    public IOParserContext(@Nonnull Reader theReader, @Nonnull RDFHandler theHandler, @Nonnull Options theOptions)

- ## Method Details

  - ### langBuffer

    public StringBuilder langBuffer()
    Rest the buffer that can be used for parsing language tags and return it
    Returns:
      the buffer

  - ### datatypeBuffer

    public StringBuilder datatypeBuffer()
    Reset the buffer for parsing datatypes and return it
    Returns:
      the buffer

  - ### resetSB

    public StringBuilder resetSB()

  - ### trimSB

    public StringBuilder trimSB()

  - ### peekCodePoint

    public int peekCodePoint() throws IOException
    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

    public int readCodePoint() throws IOException
    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

    public void unread(int theCodePoint) throws IOException
    Pushes back a single code point by copying it to the front of the buffer. After this method returns, a call to `readCodePoint()` will return the same code point c again.
    Parameters:
      `theCodePoint` - a single Unicode code point.
    Throws:
      `IOException`

  - ### unread

    public void unread(@Nonnull String theStr)
    Pushes back the supplied string by copying it to the front of the buffer. After this method returns, successive calls to `readCodePoint()` 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

    public int verifyCharacterOrFail(@Nonnull String expected) throws IOException
    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

    public int verifyCharacterOrFail(@Nonnull char expected) throws IOException
    Throws:
      `IOException`

  - ### verifyCharacterOrFail

    public int verifyCharacterOrFail(int codePoint, @Nonnull String expected) throws InvalidRDF
    Throws:
      `InvalidRDF`