net.dpml.metro.builder
Class ComponentEncoder

java.lang.Object
  extended bynet.dpml.metro.builder.ComponentConstants
      extended bynet.dpml.metro.builder.ComponentEncoder
All Implemented Interfaces:
Encoder

public class ComponentEncoder
extends net.dpml.metro.builder.ComponentConstants
implements Encoder

Component part handler.

Version:
1.0.1
Author:
Digital Product Meta Library

Constructor Summary
ComponentEncoder()
           
 
Method Summary
 void encode(Writer writer, Object object, String pad)
          Export a component directive to an output stream as XML.
 void export(ComponentDirective directive, OutputStream output)
          Export a component directive to an output stream as XML.
 String toString()
          Return a string representation of the object.
 void writeComponent(Writer writer, ComponentDirective directive, String pad)
          Export a component directive to an output stream as XML.
protected  void writeEntry(Writer writer, String key, ValueDirective value, String pad)
          Write a context entry.
protected  void writeParts(Writer writer, PartReference[] parts, String pad, boolean flag)
          Write a collection of part references.
 void writeTaggedComponent(Writer writer, ComponentDirective directive, String key, String pad)
          Export a tagged component directive to an output stream as XML.
 void writeTaggedComponent(Writer writer, ComponentDirective directive, String key, String pad, boolean flag)
          Export a tagged component directive to an output stream as XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentEncoder

public ComponentEncoder()
Method Detail

export

public void export(ComponentDirective directive,
                   OutputStream output)
            throws IOException
Export a component directive to an output stream as XML.

Parameters:
directive - the component directive
output - the output stream
Throws:
IOException - if an IO error occurs

encode

public void encode(Writer writer,
                   Object object,
                   String pad)
            throws IOException
Export a component directive to an output stream as XML.

Specified by:
encode in interface Encoder
Parameters:
writer - the print writer
object - the object to encode
pad - character offset
Throws:
IOException - if an IO error occurs

writeComponent

public void writeComponent(Writer writer,
                           ComponentDirective directive,
                           String pad)
                    throws IOException
Export a component directive to an output stream as XML.

Parameters:
writer - the print writer
directive - the component directive
pad - character offset
Throws:
IOException - if an IO error occurs

writeTaggedComponent

public void writeTaggedComponent(Writer writer,
                                 ComponentDirective directive,
                                 String key,
                                 String pad)
                          throws IOException
Export a tagged component directive to an output stream as XML.

Parameters:
writer - the print writer
directive - the component directive
key - the key identifying the component
pad - character offset
Throws:
IOException - if an IO error occurs

writeTaggedComponent

public void writeTaggedComponent(Writer writer,
                                 ComponentDirective directive,
                                 String key,
                                 String pad,
                                 boolean flag)
                          throws IOException
Export a tagged component directive to an output stream as XML.

Parameters:
writer - the print writer
directive - the component directive
key - the key identifying the component
pad - character offset
flag - true if the xml namespace should be included
Throws:
IOException - if an IO error occurs

writeParts

protected void writeParts(Writer writer,
                          PartReference[] parts,
                          String pad,
                          boolean flag)
                   throws IOException
Write a collection of part references.

Parameters:
writer - the writer
parts - the part refernece array
pad - the offset
flag - true if the xml namespace should be included
Throws:
IOException - if an IO error occurs

writeEntry

protected void writeEntry(Writer writer,
                          String key,
                          ValueDirective value,
                          String pad)
                   throws IOException
Write a context entry.

Parameters:
writer - the writer
key - the entry key
value - the value directive
pad - the offset
Throws:
IOException - if an IO error occurs

toString

public String toString()
Return a string representation of the object.

Returns:
the string value