com.tagtraum.sixbs
Class SIXBSWriter

java.lang.Object
  |
  +--com.tagtraum.sixbs.SIXBSWriter

public class SIXBSWriter
extends Object

Serializes beans to XML.

Version:
$Id: SIXBSWriter.java,v 1.2 2001/05/11 16:45:16 Hendrik Exp $
Author:
Hendrik Schreiber

Field Summary
static String vcid
          Source-Version
 
Constructor Summary
SIXBSWriter(OutputStream out, boolean append)
          Uses default char encoding.
SIXBSWriter(OutputStream out, boolean append, String encoding)
          For performance reasons the OutputStream should be buffered. sixbs does not buffer.
SIXBSWriter(OutputStreamWriter out, AdapterFinder adapterFinder, boolean append)
          For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
SIXBSWriter(Writer out)
          For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
SIXBSWriter(Writer out, AdapterFinder adapterFinder, boolean append)
          For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
SIXBSWriter(Writer out, AdapterFinder adapterFinder, boolean append, String encoding)
          For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
SIXBSWriter(Writer out, boolean append)
          For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
 
Method Summary
 void close()
          Close the stream, flushing it first.
static String encode(String elementValue)
          Encodes the string value of an element (text node) to an XML conform format, special characters such the ampersand (&) are replaced by an entities (&).
 void flush()
          Flush the stream.
protected  void writeFooter()
          Writes a closing </sixbs> tag.
protected  void writeHeader()
          Writes the xml declaration, and an opening <sixbs> tag.
 void writeObject(Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vcid

public static String vcid
Source-Version
Constructor Detail

SIXBSWriter

public SIXBSWriter(OutputStream out,
                   boolean append)
            throws IOException
Uses default char encoding. The default AdapterFinder is used.
Parameters:
out - OutputStream to write objects to with the specified encoding.
append - if true, no XML declaration (<?xml version="1.0"?>) and the sixbs tag aren't written .

SIXBSWriter

public SIXBSWriter(OutputStream out,
                   boolean append,
                   String encoding)
            throws IOException
For performance reasons the OutputStream should be buffered. sixbs does not buffer. The default AdapterFinder is used.
Parameters:
out - OutputStream to write objects to with the specified encoding.
append - if true, no XML declaration (<?xml version="1.0"?>) and the sixbs tag aren't written .
encoding - char set to be used

SIXBSWriter

public SIXBSWriter(Writer out)
            throws IOException
For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer. No XML declaration is written. The default AdapterFinder is used. Append is set to false.
Parameters:
out - Writer to write objects to.

SIXBSWriter

public SIXBSWriter(Writer out,
                   boolean append)
            throws IOException
For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
Parameters:
append - if true, no XML declaration (<?xml version="1.0"?>) and the sixbs tag aren't written .
out - Writer to write objects to.

SIXBSWriter

public SIXBSWriter(Writer out,
                   AdapterFinder adapterFinder,
                   boolean append)
            throws IOException
For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
Parameters:
out - Writer to write objects to.
append - if true, no XML declaration (<?xml version="1.0"?>) and the sixbs tag aren't written .

SIXBSWriter

public SIXBSWriter(OutputStreamWriter out,
                   AdapterFinder adapterFinder,
                   boolean append)
            throws IOException
For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
Parameters:
out - Writer to write objects to with the specified encoding.
append - if true, no XML declaration (<?xml version="1.0"?>) and the sixbs tag aren't written .
adapterFinder - the adapterFinder to use

SIXBSWriter

public SIXBSWriter(Writer out,
                   AdapterFinder adapterFinder,
                   boolean append,
                   String encoding)
            throws IOException
For performance reasons the Writer should be buffered. sixbs does not buffer. sixbs will write with the systems default encoding or the encoding set in the provided buffer.
Parameters:
out - Writer to write objects to with the specified encoding.
append - if true, no XML declaration (<?xml version="1.0"?>)is written.
adapterFinder - the adapterFinder to use
encoding - encoding that is used by the writer - set null, if unknwon
Method Detail

writeHeader

protected void writeHeader()
                    throws IOException
Writes the xml declaration, and an opening <sixbs> tag. Is called, if append to false.

writeFooter

protected void writeFooter()
                    throws IOException
Writes a closing </sixbs> tag. Is called, if append to false.

writeObject

public void writeObject(Object obj)
                 throws IOException

flush

public void flush()
           throws IOException
Flush the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.
Throws:
IOException - If an I/O error occurs

close

public void close()
           throws IOException
Close the stream, flushing it first. Once a stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. If this writer does not operate in append-mode, a closing </sixbs> tag will be written.
Throws:
IOException - If an I/O error occurs
See Also:
writeHeader(), writeFooter()

encode

public static String encode(String elementValue)
Encodes the string value of an element (text node) to an XML conform format, special characters such the ampersand (&) are replaced by an entities (&).
Parameters:
elementValue - the string value to be encoded
Returns:
the XML compliant string value.


Copyright © 2001 tagtraum industries.