Class NTriplesWriter

    • Field Detail

      • writer

        protected final java.io.Writer writer
      • xsdStringToPlainLiteral

        private boolean xsdStringToPlainLiteral
      • escapeUnicode

        private boolean escapeUnicode
    • Constructor Detail

      • NTriplesWriter

        public NTriplesWriter​(java.io.OutputStream out)
        Creates a new NTriplesWriter that will write to the supplied OutputStream.
        Parameters:
        out - The OutputStream to write the N-Triples document to.
      • NTriplesWriter

        public NTriplesWriter​(java.io.Writer writer)
        Creates a new NTriplesWriter that will write to the supplied Writer.
        Parameters:
        writer - The Writer to write the N-Triples document to.
    • Method Detail

      • getWriter

        public java.io.Writer getWriter()
        Description copied from interface: CharSink
        get the Writer used by this CharSink.
        Specified by:
        getWriter in interface CharSink
        Returns:
        an Writer
      • endRDF

        public void endRDF()
                    throws RDFHandlerException
        Description copied from interface: RDFHandler
        Signals the end of the RDF data. This method is called when all data has been reported.
        Specified by:
        endRDF in interface RDFHandler
        Throws:
        RDFHandlerException - If the RDF handler has encountered an unrecoverable error.
      • handleNamespace

        public void handleNamespace​(java.lang.String prefix,
                                    java.lang.String name)
        Description copied from interface: RDFHandler
        Handles a namespace declaration/definition. A namespace declaration associates a (short) prefix string with the namespace's URI. The prefix for default namespaces, which do not have an associated prefix, are represented as empty strings.
        Specified by:
        handleNamespace in interface RDFHandler
        Overrides:
        handleNamespace in class AbstractRDFWriter
        Parameters:
        prefix - The prefix for the namespace, or an empty string in case of a default namespace.
        name - The URI that the prefix maps to.
      • writeValue

        protected void writeValue​(Value value)
                           throws java.io.IOException
        Writes the N-Triples representation of the given Value.
        Parameters:
        value - The value to write.
        Throws:
        java.io.IOException
      • writeIRI

        private void writeIRI​(IRI iri)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeBNode

        private void writeBNode​(BNode bNode)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLiteral

        private void writeLiteral​(Literal lit)
                           throws java.io.IOException
        Write the N-Triples representation of the given Literal, optionally ignoring the xsd:string datatype as it is implied for RDF-1.1.
        Parameters:
        lit - The literal to write.
        Throws:
        java.io.IOException