ePOST API

rice.p2p.util
Class XMLWriter

java.lang.Object
  extended by rice.p2p.util.XMLWriter

public class XMLWriter
extends java.lang.Object

XMLWriter is a utility class used by XMLObjectOutputStream to perform the actual XML writing. This writing is based on the XML Pull-Parsing API, available online at http://www.xmlpull.org. Any of the provided serializer implementations will work with this reader.

Version:
$Id: XMLWriter.java 2324 2005-03-14 23:00:27Z amislove $
Author:
Alan Mislove

Field Summary
protected  org.xmlpull.v1.XmlSerializer serializer
          The actual XML serializer, which does the writing
protected  java.io.Writer writer
          The underlying writer which the serializer uses
 
Constructor Summary
XMLWriter(java.io.OutputStream out)
          Constructor which takes the provided writer and builds a new XML writier to read XML from the writier.
 
Method Summary
 void attribute(java.lang.String name, boolean value)
          Method which writes an attribute to the XML document.
 void attribute(java.lang.String name, char value)
          Method which writes an attribute to the XML document.
 void attribute(java.lang.String name, double value)
          Method which writes an attribute to the XML document.
 void attribute(java.lang.String name, float value)
          Method which writes an attribute to the XML document.
 void attribute(java.lang.String name, int value)
          Method which writes an attribute to the XML document.
 void attribute(java.lang.String name, long value)
          Method which writes an attribute to the XML document.
 void attribute(java.lang.String name, java.lang.Object value)
          Method which writes an attribute to the XML document.
protected  void attribute(java.lang.String name, java.lang.String value)
          Method which writes an attribute to the XML document.
 void close()
          Method which flushes and closes the underlying writer, which will cause future writer attempts to throw an IOException.
 void end(java.lang.String name)
          Method which ends the given tag name
 void flush()
          Method which flushes all buffered data to the underlying writer
 void start(java.lang.String name)
          Method which starts the given tag name
 void writeBase64(byte[] bytes, int off, int len)
          Method which writes a sequence of base64 encoded bytes to the output stream
 void writeHeader()
          Method which writes the XML header to the writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serializer

protected org.xmlpull.v1.XmlSerializer serializer
The actual XML serializer, which does the writing


writer

protected java.io.Writer writer
The underlying writer which the serializer uses

Constructor Detail

XMLWriter

public XMLWriter(java.io.OutputStream out)
          throws java.io.IOException
Constructor which takes the provided writer and builds a new XML writier to read XML from the writier.

Parameters:
out - The writer to base this XML writer off of
Throws:
java.io.IOException - If an error occurs
Method Detail

flush

public void flush()
           throws java.io.IOException
Method which flushes all buffered data to the underlying writer

Throws:
java.io.IOException - If an error occurs

close

public void close()
           throws java.io.IOException
Method which flushes and closes the underlying writer, which will cause future writer attempts to throw an IOException.

Throws:
java.io.IOException - If an error occurs

writeBase64

public void writeBase64(byte[] bytes,
                        int off,
                        int len)
                 throws java.io.IOException
Method which writes a sequence of base64 encoded bytes to the output stream

Parameters:
bytes - The bytes to write
Throws:
java.io.IOException

writeHeader

public void writeHeader()
                 throws java.io.IOException
Method which writes the XML header to the writer.

Throws:
java.io.IOException - If an error occurs

attribute

public void attribute(java.lang.String name,
                      int value)
               throws java.io.IOException
Method which writes an attribute to the XML document.

Parameters:
name - The name of the attribute to write
value - The value to write
Throws:
java.io.IOException - If an error occurs

attribute

public void attribute(java.lang.String name,
                      double value)
               throws java.io.IOException
Method which writes an attribute to the XML document.

Parameters:
name - The name of the attribute to write
value - The value to write
Throws:
java.io.IOException - If an error occurs

attribute

public void attribute(java.lang.String name,
                      float value)
               throws java.io.IOException
Method which writes an attribute to the XML document.

Parameters:
name - The name of the attribute to write
value - The value to write
Throws:
java.io.IOException - If an error occurs

attribute

public void attribute(java.lang.String name,
                      long value)
               throws java.io.IOException
Method which writes an attribute to the XML document.

Parameters:
name - The name of the attribute to write
value - The value to write
Throws:
java.io.IOException - If an error occurs

attribute

public void attribute(java.lang.String name,
                      char value)
               throws java.io.IOException
Method which writes an attribute to the XML document.

Parameters:
name - The name of the attribute to write
value - The value to write
Throws:
java.io.IOException - If an error occurs

attribute

public void attribute(java.lang.String name,
                      boolean value)
               throws java.io.IOException
Method which writes an attribute to the XML document.

Parameters:
name - The name of the attribute to write
value - The value to write
Throws:
java.io.IOException - If an error occurs

attribute

public void attribute(java.lang.String name,
                      java.lang.Object value)
               throws java.io.IOException
Method which writes an attribute to the XML document.

Parameters:
name - The name of the attribute to write
value - The value to write
Throws:
java.io.IOException - If an error occurs

attribute

protected void attribute(java.lang.String name,
                         java.lang.String value)
                  throws java.io.IOException
Method which writes an attribute to the XML document.

Parameters:
name - The name of the attribute to write
value - The value to write
Throws:
java.io.IOException - If an error occurs

start

public void start(java.lang.String name)
           throws java.io.IOException
Method which starts the given tag name

Parameters:
name - The name of the tag to start
Throws:
java.io.IOException - If an error occurs

end

public void end(java.lang.String name)
         throws java.io.IOException
Method which ends the given tag name

Parameters:
name - The name of the tag to end
Throws:
java.io.IOException - If an error occurs

ePOST API

Copyright © 2001-2005 - Rice Pastry.