KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > rdf > model > RDFWriter


1 /*
2  * (c) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * $Id: RDFWriter.java,v 1.9 2005/02/21 12:14:23 andy_seaborne Exp $
28  */

29
30 package com.hp.hpl.jena.rdf.model;
31 import java.io.Writer JavaDoc;
32 import java.io.OutputStream JavaDoc;
33 /** RDFWriter is an interface to RDF serializers.
34  *
35  * <p>An <code>RDFWriter</code> is a class which serializes an RDF model
36  * to some RDF serializaion language. RDF/XML, n-triple and n3 are
37  * examples of serialization languages.</p>
38  * @author bwm
39  * @version $Revision: 1.9 $
40  */

41 public interface RDFWriter {
42
43     public static final String JavaDoc NSPREFIXPROPBASE
44       = "com.hp.hpl.jena.nsprefix.";
45     /** Caution: Serialize Model <code>model</code> to Writer <code>out</code>.
46      * It is often better to use an OutputStream and permit Jena
47      * to choose the character encoding. The charset restrictions
48      * on the Writer are defined by the different implementations
49      * of this interface. Typically using an OutputStreamWriter (e.g.
50      * a FileWriter) at least permits the implementation to
51      * examine the encoding. With an arbitrary Writer implementations
52      * assume a utf-8 encoding.
53      *
54      * @param out The Writer to which the serialization should
55      * be sent.
56      * @param model The model to be written.
57      * @param base the base URI for relative URI calculations. <code>
58        null</code> means use only absolute URI's.
59      */

60         public void write(Model model, Writer JavaDoc out, String JavaDoc base);
61     
62     
63 /** Serialize Model <code>model</code> to OutputStream <code>out</out>.
64  * The implementation chooses the character encoding, utf-8 is preferred.
65  *
66  *
67  * @param out The OutputStream to which the serialization should be sent.
68  * @param model The model to be written.
69  * @param base the base URI for relative URI calculations. <code>
70    null</code> means use only absolute URI's.
71  */

72     public void write(Model model, OutputStream JavaDoc out, String JavaDoc base);
73     
74 /** Set a property to control the behaviour of this writer.
75  *
76  * <p>An RDFWriter's behaviour can be influenced by defining property values
77  * interpreted by that particular writer class. The values for such
78  * properties can be changed by calling this method. </p>
79  *
80  * <p>No standard properties are defined. For the properties recognised
81  * by any particular writer implementation, see the the documentation for
82  * that implementation. </p>
83  * <p>
84  * The built-in RDFWriters have properties as defined by:
85  * <dl>
86  * <dt>N3</dt><dt>N-TRIPLE</dt>
87  * <dd>No properties.</dd>
88  * <dt>RDF/XML</dt><dt>RDF/XML-ABBREV</dt>
89  * </dl>
90  * @return the old value for this property, or <code>null</code>
91  * if no value was set.
92  * @param propName The name of the property.
93  * @param propValue The new value of the property
94  */

95     public Object JavaDoc setProperty(String JavaDoc propName, Object JavaDoc propValue);
96
97 /** Set an error handler.
98  * @param errHandler The new error handler to be used.
99  * @return the old error handler
100  */

101     public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler);
102 }
103
Popular Tags