Class NTripleWriter

java.lang.Object
org.apache.jena.rdf.model.impl.NTripleWriter
All Implemented Interfaces:
RDFWriterI

public class NTripleWriter extends Object implements RDFWriterI
Writes out an XML serialization of a model.
  • Constructor Details

    • NTripleWriter

      public NTripleWriter()
  • Method Details

    • write

      public void write(Model model, OutputStream out, String base)
      Description copied from interface: RDFWriterI
      Serialize Model model to OutputStream out. The implementation chooses the character encoding, utf-8 is preferred.
      Specified by:
      write in interface RDFWriterI
      Parameters:
      model - The model to be written.
      out - The OutputStream to which the serialization should be sent.
      base - the base URI for relative URI calculations. null means use only absolute URI's. This is used for relative URIs that would be resolved against the document retrieval URL. Particular writers may include this value in the output.
    • write

      public void write(Model model, Writer writer, String base)
      Description copied from interface: RDFWriterI
      Caution: Serialize Model model to Writer out. It is often better to use an OutputStream and permit Jena to choose the character encoding. The charset restrictions on the Writer are defined by the different implementations of this interface. Typically using an OutputStreamWriter (e.g. a FileWriter) at least permits the implementation to examine the encoding. With an arbitrary Writer implementations assume a utf-8 encoding.
      Specified by:
      write in interface RDFWriterI
      Parameters:
      model - The model to be written.
      writer - The Writer to which the serialization should be sent.
      base - the base URI for relative URI calculations. null means use only absolute URI's.
    • setProperty

      public Object setProperty(String propName, Object propValue)
      Set a property to control the writer's behaviour.

      This writer currently recognises no properties. Invoking this method always causes an UnknownPropertyException to be raised.

      ?
      Specified by:
      setProperty in interface RDFWriterI
      Parameters:
      propName - The name of the property to be set
      propValue - The new value of the property
      Returns:
      the previous value of the property
    • setNsPrefix

      public void setNsPrefix(String prefix, String ns)
    • getPrefixFor

      public String getPrefixFor(String uri)
    • setErrorHandler

      public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler)
      Description copied from interface: RDFWriterI
      Set an error handler.
      Specified by:
      setErrorHandler in interface RDFWriterI
      Parameters:
      errHandler - The new error handler to be used.
      Returns:
      the old error handler
    • write

      public static void write(Model model, PrintWriter writer)