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
RDFWriter
implementation 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 class
NTWriter.NTWriterFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
comment(java.lang.String theComment)
Write a comment to the output.void
end()
Signals the writing process is completed.RDFFormat
format()
Theformat
this writer will serialize output in.void
handle(Statement theStmt)
Write the givenStatement
void
namespace(java.lang.String thePrefix, java.lang.String theIRI)
Provide a namespace to the writer.static void
serialize(BNode theObj, java.io.Writer theWriter)
static void
serialize(IRI theObj, java.io.Writer theWriter)
static void
serialize(Literal theObj, boolean theSimplify, java.io.Writer theWriter)
static void
serialize(Value theObj, boolean theSimplify, java.io.Writer theWriter)
void
start()
Signals that the RDF writing process is starting.
-
-
-
Method Detail
-
end
public void end()
Signals the writing process is completed. The underlyingInputStream
is *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:
end
in interfaceRDFHandler
- Specified by:
end
in interfaceRDFWriter
-
start
public void start()
Signals that the RDF writing process is starting.- Specified by:
start
in interfaceRDFHandler
- Specified by:
start
in 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:
namespace
in interfaceRDFHandler
- Specified by:
namespace
in 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 bestarted
at this point; comments can be written prior to any actual serialized RDF
-
handle
public void handle(@Nonnull Statement theStmt)
Write the givenStatement
- Specified by:
handle
in interfaceRDFHandler
- Specified by:
handle
in 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
-
-