Package org.eclipse.rdf4j.rio.ntriples
Class NTriplesWriter
- java.lang.Object
-
- org.eclipse.rdf4j.rio.helpers.AbstractRDFWriter
-
- org.eclipse.rdf4j.rio.ntriples.NTriplesWriter
-
- All Implemented Interfaces:
org.eclipse.rdf4j.common.io.CharSink,org.eclipse.rdf4j.common.io.Sink,RDFHandler,RDFWriter
public class NTriplesWriter extends AbstractRDFWriter implements org.eclipse.rdf4j.common.io.CharSink
An implementation of the RDFWriter interface that writes RDF documents in N-Triples format. The N-Triples format is defined in this section of the RDF Test Cases document.
-
-
Field Summary
Fields Modifier and Type Field Description protected Writerwriter-
Fields inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFWriter
namespaceTable, statementConsumer
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconsumeStatement(org.eclipse.rdf4j.model.Statement st)voidendRDF()RDFFormatgetRDFFormat()Collection<RioSetting<?>>getSupportedSettings()WritergetWriter()voidhandleComment(String comment)voidhandleNamespace(String prefix, String name)voidstartRDF()protected voidwriteValue(org.eclipse.rdf4j.model.Value value)Writes the N-Triples representation of the givenValue.-
Methods inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFWriter
checkWritingStarted, getFileFormat, getWriterConfig, handleStatement, isWritingStarted, set, setWriterConfig
-
-
-
-
Field Detail
-
writer
protected final Writer writer
-
-
Constructor Detail
-
NTriplesWriter
public NTriplesWriter(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(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 Writer getWriter()
- Specified by:
getWriterin interfaceorg.eclipse.rdf4j.common.io.CharSink
-
getRDFFormat
public RDFFormat getRDFFormat()
- Specified by:
getRDFFormatin interfaceRDFWriter
-
startRDF
public void startRDF() throws RDFHandlerException- Specified by:
startRDFin interfaceRDFHandler- Overrides:
startRDFin classAbstractRDFWriter- Throws:
RDFHandlerException
-
endRDF
public void endRDF() throws RDFHandlerException- Specified by:
endRDFin interfaceRDFHandler- Throws:
RDFHandlerException
-
handleNamespace
public void handleNamespace(String prefix, String name)
- Specified by:
handleNamespacein interfaceRDFHandler- Overrides:
handleNamespacein classAbstractRDFWriter
-
consumeStatement
protected void consumeStatement(org.eclipse.rdf4j.model.Statement st)
- Overrides:
consumeStatementin classAbstractRDFWriter
-
handleComment
public void handleComment(String comment) throws RDFHandlerException
- Specified by:
handleCommentin interfaceRDFHandler- Throws:
RDFHandlerException
-
getSupportedSettings
public final Collection<RioSetting<?>> getSupportedSettings()
- Specified by:
getSupportedSettingsin interfaceRDFWriter- Overrides:
getSupportedSettingsin classAbstractRDFWriter
-
writeValue
protected void writeValue(org.eclipse.rdf4j.model.Value value) throws IOExceptionWrites the N-Triples representation of the givenValue.- Parameters:
value- The value to write.- Throws:
IOException
-
-