Package com.stardog.stark.io.ntriples
Class NTWriter
- java.lang.Object
-
- com.stardog.stark.io.ntriples.NTWriter
-
- All Implemented Interfaces:
RDFHandler,RDFWriter
public final class NTWriter extends java.lang.Object implements RDFWriter
RDFWriterimplementation for the N-Triples RDF format- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove
- See Also:
RDFFormats.NTRIPLES,NTParser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNTWriter.NTWriterFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomment(java.lang.String theComment)Write a comment to the output.voidend()Signals the writing process is completed.RDFFormatformat()Theformatthis writer will serialize output in.voidhandle(Statement theStmt)Write the givenStatementvoidnamespace(java.lang.String thePrefix, java.lang.String theIRI)Provide a namespace to the writer.static voidserialize(BNode theObj, java.io.Writer theWriter)static voidserialize(IRI theObj, java.io.Writer theWriter)static voidserialize(Literal theObj, boolean theSimplify, java.io.Writer theWriter)static voidserialize(Value theObj, boolean theSimplify, java.io.Writer theWriter)voidstart()Signals that the RDF writing process is starting.
-
-
-
Method Detail
-
end
public void end()
Signals the writing process is completed. The underlyingInputStreamis *not* closed, but the caller should not call additional methods on this writer as that will normally yield syntax errors in the output.- Specified by:
endin interfaceRDFHandler- Specified by:
endin interfaceRDFWriter
-
start
public void start()
Signals that the RDF writing process is starting.- Specified by:
startin interfaceRDFHandler- Specified by:
startin interfaceRDFWriter
-
namespace
public void namespace(@Nonnull java.lang.String thePrefix, @Nonnull java.lang.String theIRI)Provide a namespace to the writer. This method can be called before writing hasstarted, in which case, the namespace bindings are buffered and written when appropriate after writing has begun.- Specified by:
namespacein interfaceRDFHandler- Specified by:
namespacein interfaceRDFWriter- Parameters:
thePrefix- the namespace prefixtheIRI- the associated IRI
-
comment
public void comment(@Nonnull java.lang.String theComment)Write a comment to the output. Writing need not bestartedat this point; comments can be written prior to any actual serialized RDF
-
handle
public void handle(@Nonnull Statement theStmt)Write the givenStatement- Specified by:
handlein interfaceRDFHandler- Specified by:
handlein interfaceRDFWriter- Parameters:
theStmt- the statement to write
-
serialize
public static void serialize(@Nonnull Value theObj, boolean theSimplify, java.io.Writer theWriter) throws java.io.IOException- Throws:
java.io.IOException
-
serialize
public static void serialize(@Nonnull IRI theObj, java.io.Writer theWriter) throws java.io.IOException- Throws:
java.io.IOException
-
serialize
public static void serialize(@Nonnull BNode theObj, java.io.Writer theWriter) throws java.io.IOException- Throws:
java.io.IOException
-
serialize
public static void serialize(@Nonnull Literal theObj, boolean theSimplify, java.io.Writer theWriter) throws java.io.IOException- Throws:
java.io.IOException
-
-