Package com.stardog.stark.io.ntriples

# Class NTParser

java.lang.Object
com.stardog.stark.io.ntriples.NTParser

All Implemented Interfaces:
  `RDFParser`

Direct Known Subclasses:
  `NQuadsParser`

public class NTParser extends Object implements RDFParser

Default implementation of a `parser` for the RDF NTriples syntax

Since:
  1.0
Version:
  1.0
Author:
  Michael Grove
Implementation Notes:
  non-final because it shares a lot of parsing code with nquads

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final org.slf4j.Logger`
  `LOGGER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NTParser()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected int`
  `assertLineTerminates(IOParserContext theContext)`
  Verifies that there is only whitespace or comments until the end of the line.
  `RDFFormat`
  `format()`
  The format this parser can parse
  `void`
  `parse(IOParserContext theContext)`
  `void`
  `parse(InputStream theStream, RDFHandler theRDFHandler, Options theOptions)`
  Parse the content
  `protected int`
  `parseNodeID(IOParserContext theContext, int c, StringBuilder name)`
  `protected int`
  `parseObject(IOParserContext theContext, int ch)`
  `protected int`
  `parsePredicate(IOParserContext theContext, int ch)`
  `protected int`
  `parseSubject(IOParserContext theContext, int ch)`
  `protected int`
  `parseUriRef(IOParserContext theContext, int ch, StringBuilder uriRef)`
  `protected int`
  `skipLine(int theChar, IOParserContext theContext)`
  Reads characters from reader until the first EOL has been read.
  `protected int`
  `skipToEndOfLine(IOParserContext theContext, int theChar)`
  Reads characters from reader until the first EOL has been read.
  `protected int`
  `skipWhitespace(IOParserContext theContext, int theChar)`
  Reads characters from reader until it finds a character that is not a space or tab, and returns this last character code point.

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

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

  ### Methods inherited from interface com.stardog.stark.io.RDFParser

  `parse`

- ## Field Details

  - ### LOGGER

    protected static final org.slf4j.Logger LOGGER

- ## Constructor Details

  - ### NTParser

    public NTParser()

- ## Method Details

  - ### format

    @Nonnull public RDFFormat format()
    The format this parser can parse
    Specified by:
      `format` in interface `RDFParser`
    Returns:
      the format

  - ### parse

    public void parse(@Nonnull InputStream theStream, @Nonnull RDFHandler theRDFHandler, @Nonnull Options theOptions) throws IOException
    Parse the content
    Specified by:
      `parse` in interface `RDFParser`
    Parameters:
      `theStream` - the stream to read from
      `theRDFHandler` - the handler to pass parse events to
      `theOptions` - the parsing options
    Throws:
      `IOException` - if there was an error while reading from the stream

  - ### parse

    public void parse(@Nonnull IOParserContext theContext) throws IOException
    Throws:
      `IOException`

  - ### parseSubject

    protected int parseSubject(@Nonnull IOParserContext theContext, int ch) throws IOException
    Throws:
      `IOException`

  - ### parsePredicate

    protected int parsePredicate(@Nonnull IOParserContext theContext, int ch) throws IOException
    Throws:
      `IOException`

  - ### parseObject

    protected int parseObject(@Nonnull IOParserContext theContext, int ch) throws IOException
    Throws:
      `IOException`

  - ### parseUriRef

    protected int parseUriRef(@Nonnull IOParserContext theContext, int ch, StringBuilder uriRef) throws IOException
    Throws:
      `IOException`

  - ### parseNodeID

    protected int parseNodeID(@Nonnull IOParserContext theContext, int c, @Nonnull StringBuilder name) throws IOException
    Throws:
      `IOException`

  - ### assertLineTerminates

    protected int assertLineTerminates(@Nonnull IOParserContext theContext) throws IOException
    Verifies that there is only whitespace or comments until the end of the line.
    Throws:
      `IOException`

  - ### skipToEndOfLine

    protected int skipToEndOfLine(@Nonnull IOParserContext theContext, int theChar) throws IOException
    Reads characters from reader until the first EOL has been read. The EOL character or -1 is returned.
    Throws:
      `IOException`

  - ### skipLine

    protected int skipLine(int theChar, @Nonnull IOParserContext theContext) throws IOException
    Reads characters from reader until the first EOL has been read. The first character after the EOL is returned. In case the end of the character stream has been reached, -1 is returned.
    Throws:
      `IOException`

  - ### skipWhitespace

    protected int skipWhitespace(@Nonnull IOParserContext theContext, int theChar) throws IOException
    Reads characters from reader until it finds a character that is not a space or tab, and returns this last character code point. In case the end of the character stream has been reached, -1 is returned.
    Throws:
      `IOException`