All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.xmlmiddleware.xmldbms.filters.FilterSerializer

java.lang.Object
   |
   +----org.xmlmiddleware.xmlutils.XMLWriter
           |
           +----org.xmlmiddleware.xmldbms.filters.FilterSerializer

public class FilterSerializer
extends XMLWriter
Serializes a FilterSet object to a character stream.

If you want to use a specific encoding, the Writer must be an OutputStreamWriter or a subclass of an OutputStreamWriter. For example, you might use the following code to write a map file with the Shift_JIS encoding:

    // Construct the FileOutputStream.
    OutputStream out = new FileOutputStream("sales.map");
    
// Construct the OutputStreamWriter with the Shift_JIS encoding. This may // throw an UnsupportedEncodingException. Writer writer = new OutputStreamWriter(out, "Shift_JIS");
// Construct the FilterSerializer. FilterSerializer serializer = new FilterSerializer(writer);
// Serialize the filter set. serializer.serialize(filterSet);
// Close the file. writer.close();

If you want to use the default encoding, you can just use a FileWriter. However, no encoding declaration will be written in the XML declaration. For example:

    // Construct a new FileWriter.
    Writer writer = new FileWriter("sales.map");
    
// Construct the FilterSerializer. FilterSerializer serializer = new FilterSerializer(writer);
// Serialize the filter set. serializer.serialize(filterSet);
// Close the file. writer.close();

Version:
2.0
Author:
Ronald Bourret, 2002

Constructor Index

 o FilterSerializer()
Construct a new FilterSerializer.
 o FilterSerializer(Writer)
Construct a new FilterSerializer and set the Writer.

Method Index

 o serialize(FilterSet)
Serialize a FilterSet to the filter language.
 o serialize(FilterSet, String, String)
Serialize a FilterSet to the filter language.
 o setWriter(Writer)
Set the Writer.

Constructors

 o FilterSerializer
 public FilterSerializer()
Construct a new FilterSerializer.

 o FilterSerializer
 public FilterSerializer(Writer writer)
Construct a new FilterSerializer and set the Writer.

Parameters:
writer - The writer. The writer must implement the write(String,int,int) and write(int) methods.

Methods

 o setWriter
 public void setWriter(Writer writer)
Set the Writer.

Parameters:
writer - The writer. The writer must implement the write(String,int,int) and write(int) methods.
Overrides:
setWriter in class XMLWriter
 o serialize
 public void serialize(FilterSet filterSet) throws IOException
Serialize a FilterSet to the filter language.

No system or public ID is written in the DOCTYPE statement.

Parameters:
map - The FilterSet.
Throws: IOException
Thrown if an I/O exception occurs.
 o serialize
 public void serialize(FilterSet filterSet,
                       String systemID,
                       String publicID) throws IOException
Serialize a FilterSet to the filter language.

Parameters:
filterSet - The FilterSet.
systemID - System ID of the DTD. If this is null, "filters.dtd" is used.
publicID - Public ID of the DTD. May be null.
Throws: IOException
Thrown if an I/O exception occurs.

All Packages  Class Hierarchy  This Package  Previous  Next  Index