|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.hp.hpl.jena.n3.N3JenaWriter
An N3 pretty printer. Tries to make N3 data look readable - works better on regular data.
| Field Summary | |
static boolean |
DEBUG
|
static java.lang.String |
propWriteSimple
|
| Fields inherited from interface com.hp.hpl.mesa.rdf.jena.model.RDFWriter |
NSPREFIXPROPBASE |
| Constructor Summary | |
N3JenaWriter()
|
|
| Method Summary | |
RDFErrorHandler |
setErrorHandler(RDFErrorHandler errHandler)
Set an error handler. |
void |
setNsPrefix(java.lang.String prefix,
java.lang.String ns)
Set the the namespace prefix to be used for a particular namespace. |
java.lang.Object |
setProperty(java.lang.String propName,
java.lang.Object propValue)
Set a property to control the behaviour of this writer. |
void |
write(Model model,
java.io.OutputStream output,
java.lang.String base)
Write the model out in N3, encoded in in UTF-8 |
void |
write(Model model,
java.io.Writer _out,
java.lang.String base)
Write the model out in N3. |
void |
writeSimple(Model model,
java.io.Writer _out,
java.lang.String base)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static boolean DEBUG
public static final java.lang.String propWriteSimple
| Constructor Detail |
public N3JenaWriter()
| Method Detail |
public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler)
RDFWriter
setErrorHandler in interface RDFWritererrHandler - The new error handler to be used.
public void setNsPrefix(java.lang.String prefix,
java.lang.String ns)
RDFWriter
setNsPrefix in interface RDFWriterprefix - the prefix to be usedns - the namespace
public java.lang.Object setProperty(java.lang.String propName,
java.lang.Object propValue)
throws RDFException
RDFWriterAn RDFWriter's behaviour can be influenced by defining property values interpreted by that particular writer class. The values for such properties can be changed by calling this method.
No standard properties are defined. For the properties recognised by any particular writer implementation, see the the documentation for that implementation. The properties recognised by writers provided in the standard distribution can be found in the description of their setProperty method. Consult the list of implementors of this interface given above.
setProperty in interface RDFWriterpropName - The name of the property.propValue - The new value of the property
null
if no value was set.
RDFException - Throws a generic RDF exception
public void write(Model model,
java.io.Writer _out,
java.lang.String base)
throws RDFException
try {
Writer w = new BufferedWriter(new OutputStreamWriter(output, "UTF-8")) ;
model.write(w, base) ;
try { w.flush() ; } catch (IOException ioEx) {}
} catch (java.io.UnsupportedEncodingException ex) {} //UTF-8 is required so can't happen
or
try {
OutputStream out = new FileOutputStream(file) ;
Writer w = new BufferedWriter(new OutputStreamWriter(out, "UTF-8")) ;
model.write(w, base) ;
}
catch (java.io.UnsupportedEncodingException ex) {}
catch (java.io.FileNotFoundException noFileEx) { ... }
write in interface RDFWriter_out - The Writer to which the serialization should
be sent.model - The model to be written.base - the base URI for relative URI calculations.
null means use only absolute URI's.
RDFException - Generic RDF exception.
public void write(Model model,
java.io.OutputStream output,
java.lang.String base)
throws RDFException
RDFExceptionwrite(Model,Writer,String)
public void writeSimple(Model model,
java.io.Writer _out,
java.lang.String base)
throws RDFException
RDFException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||