Class Serializer

java.lang.Object
  |
  +--Serializer

public class Serializer
extends java.lang.Object

Provides XML serialization services.

Version:
$2007-05-01 03:16:54 mdh$
Author:
Malcolm D. Hyman

Field Summary
static int DEFAULT_LINE_WIDTH
           
 
Constructor Summary
Serializer(ArborPanel panel)
           
 
Method Summary
 org.apache.xml.serialize.OutputFormat outputFormatFactory(int lineWidth, boolean indenting)
          Produces OutputFormats.
 void serialize(ContentOwner owner, java.io.File sink, int lineWidth)
          Serializes the DOM owned by the specified ContentOwner to a file.
 void serialize(org.w3c.dom.Document doc, java.io.File sink)
          Serializes a DOM to a file, using the default setting for the line width parameter.
 void serialize(org.w3c.dom.Document doc, java.io.File sink, int lineWidth)
          Serializes a DOM to a file.
 java.io.ByteArrayOutputStream serialize(org.w3c.dom.Document doc, int lineWidth, boolean indenting)
          Serializes a DOM to a byte array stream.
 void serialize(org.w3c.dom.Document doc, java.io.OutputStream sink, int lineWidth, boolean indenting)
          Serializes a DOM to a specified output stream.
 void serialize(org.w3c.dom.Document doc, java.io.Writer sink, int lineWidth, boolean indenting)
          Serializes a DOM to a specified writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LINE_WIDTH

public static final int DEFAULT_LINE_WIDTH
Constructor Detail

Serializer

public Serializer(ArborPanel panel)
Method Detail

serialize

public void serialize(org.w3c.dom.Document doc,
                      java.io.File sink,
                      int lineWidth)
               throws java.io.IOException
Serializes a DOM to a file.
Parameters:
doc - DOM
sink - file sink for XML serialization
lineWidth - line width parameter for serialization

serialize

public void serialize(org.w3c.dom.Document doc,
                      java.io.File sink)
               throws java.io.IOException
Serializes a DOM to a file, using the default setting for the line width parameter.
Parameters:
doc - DOM
sink - file sink for XML serialization

serialize

public void serialize(org.w3c.dom.Document doc,
                      java.io.OutputStream sink,
                      int lineWidth,
                      boolean indenting)
               throws java.io.IOException
Serializes a DOM to a specified output stream.
Parameters:
doc - DOM
sink - output stream
lineWidth - line width parameter for serialization
indenting - true if lines are to be indented

serialize

public void serialize(org.w3c.dom.Document doc,
                      java.io.Writer sink,
                      int lineWidth,
                      boolean indenting)
               throws java.io.IOException
Serializes a DOM to a specified writer.
Parameters:
doc - DOM
sink - writer
lineWidth - line width parameter for serialization
indenting - true if lines are to be indented

serialize

public java.io.ByteArrayOutputStream serialize(org.w3c.dom.Document doc,
                                               int lineWidth,
                                               boolean indenting)
                                        throws java.io.IOException
Serializes a DOM to a byte array stream.
Parameters:
doc - DOM
lineWidth - line width parameter for serialization
indenting - true if lines are to be indented

serialize

public void serialize(ContentOwner owner,
                      java.io.File sink,
                      int lineWidth)
               throws java.io.IOException
Serializes the DOM owned by the specified ContentOwner to a file. This method respects the the "serialize.entities" property.
Parameters:
owner - a ContentOwner
sink - file sink for XML serialization
lineWidth - width for output lines

outputFormatFactory

public org.apache.xml.serialize.OutputFormat outputFormatFactory(int lineWidth,
                                                                 boolean indenting)
Produces OutputFormats. We could cache these, but we'd have to make sure that they reflected changes in user settings.
Parameters:
lineWidth - line width parameter for serialization
indenting - true if lines are to be indented