KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snipsnap > serialization > Serializer


1 package org.snipsnap.serialization;
2
3 import java.io.Writer JavaDoc;
4 import java.util.Properties JavaDoc;
5 import org.snipsnap.snip.Snip;
6
7 public abstract class Serializer {
8
9     public Serializer(int outputFormat) {
10         m_outputFormat = outputFormat;
11         m_labelSerializerFactory = new LabelSerializerFactory(outputFormat);
12         m_props = new Properties JavaDoc();
13     }
14
15     public void configure(Properties JavaDoc props) {
16         m_props = props;
17     }
18
19     /**
20      * serialize the given Snip to the given Writer
21      * @param snip the Snip to serialize (perhaps only the "entry point" or "root snip")
22      * @param writer a Writer to write generated RDF to
23      */

24     public abstract void serialize(Snip snip, Writer JavaDoc writer);
25
26     /**
27      * serialize the given Snip to the given Writer
28      * @param snip the Snip to serialize (perhaps only the "entry point" or "root snip")
29      * @param writer a Writer to write generated RDF to
30      * @param depth How many levels of snips shall be serialized. Set to -1 if you want to serialize ALL of them.
31      */

32     public abstract void serialize(Snip snip, Writer JavaDoc writer, int depth);
33
34     public int getOutputFormat() {
35         return m_outputFormat;
36     }
37
38     protected LabelSerializerFactory getLabelSerializerFactory() {
39         return m_labelSerializerFactory;
40     }
41
42     private LabelSerializerFactory m_labelSerializerFactory;
43     private int m_outputFormat;
44     protected Properties JavaDoc m_props;
45 }
46
Popular Tags