public class NTriplesWriter extends AbstractRDFWriter implements RDFWriter, CharSink
Modifier and Type | Field and Description |
---|---|
protected Writer |
writer |
namespaceTable, statementConsumer
Constructor and Description |
---|
NTriplesWriter(OutputStream out)
Creates a new NTriplesWriter that will write to the supplied OutputStream.
|
NTriplesWriter(Writer writer)
Creates a new NTriplesWriter that will write to the supplied Writer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
consumeStatement(Statement st)
Consume a statement.
|
void |
endRDF()
Signals the end of the RDF data.
|
RDFFormat |
getRDFFormat()
Gets the RDF format that this RDFWriter uses.
|
Collection<RioSetting<?>> |
getSupportedSettings() |
Writer |
getWriter()
|
void |
handleComment(String comment)
Handles a comment.
|
void |
handleNamespace(String prefix,
String name)
Handles a namespace declaration/definition.
|
void |
startRDF()
Signals the start of the RDF data.
|
protected void |
writeValue(Value value)
Writes the N-Triples representation of the given
Value . |
checkWritingStarted, getFileFormat, getWriterConfig, handleStatement, isWritingStarted, set, setWriterConfig
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWriterConfig, set, setWriterConfig
handleStatement
acceptsFileFormat, getFileFormat
protected final Writer writer
public NTriplesWriter(OutputStream out)
out
- The OutputStream to write the N-Triples document to.public NTriplesWriter(Writer writer)
writer
- The Writer to write the N-Triples document to.public RDFFormat getRDFFormat()
RDFWriter
getRDFFormat
in interface RDFWriter
public void startRDF() throws RDFHandlerException
RDFHandler
startRDF
in interface RDFHandler
startRDF
in class AbstractRDFWriter
RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void endRDF() throws RDFHandlerException
RDFHandler
endRDF
in interface RDFHandler
RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void handleNamespace(String prefix, String name)
RDFHandler
handleNamespace
in interface RDFHandler
handleNamespace
in class AbstractRDFWriter
prefix
- The prefix for the namespace, or an empty string in case of a default namespace.name
- The URI that the prefix maps to.protected void consumeStatement(Statement st)
AbstractRDFWriter
AbstractRDFWriter.handleStatement(Statement)
in order to
benefit from automatic handling of RDF-star conversion or encoding.consumeStatement
in class AbstractRDFWriter
st
- the statement to consume.public void handleComment(String comment) throws RDFHandlerException
RDFHandler
handleComment
in interface RDFHandler
comment
- The comment.RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public final Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings
in interface RDFWriter
getSupportedSettings
in class AbstractRDFWriter
RioSetting
s that are supported by this RDFWriter.protected void writeValue(Value value) throws IOException
Value
.value
- The value to write.IOException
Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.