org.kxml.io
Class XmlWriter

java.lang.Object
  extended by java.io.Writer
      extended by org.kxml.io.AbstractXmlWriter
          extended by org.kxml.io.XmlWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class XmlWriter
extends AbstractXmlWriter

a concrete XML Writer


Field Summary
protected  java.io.Writer writer
           
 
Fields inherited from class org.kxml.io.AbstractXmlWriter
current
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
XmlWriter(java.io.Writer writer)
          creates a new xmlWritet based on the given writer
 
Method Summary
 void attribute(java.lang.String name, java.lang.String value)
          writes a degenerated tag with the given name and attributes
protected  void checkPending()
           
 void close()
          closes the XmlWriter by closing the underlying writer
 void endTag()
          writes an end tag.
 void flush()
          flushes the XmlWriter.
protected  void startTag(PrefixMap prefixMap, java.lang.String tag)
          writes a start tag with the given name
 void write(char c)
          writes a single character using the xml escaping rules
 void write(char[] buf, int start, int len)
          writes an character array using the XML escaping rules
 void writeIndent()
           
 void writeLegacy(int type, java.lang.String content)
          ATTENTION: Application needs to take care about not writing illegal character sequences (like comment end in comments)
 void writeRaw(java.lang.String s)
          writes a string without escaping.
 
Methods inherited from class org.kxml.io.AbstractXmlWriter
attribute, getPrefixMap, startTag, startTag, startTag
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

protected java.io.Writer writer
Constructor Detail

XmlWriter

public XmlWriter(java.io.Writer writer)
creates a new xmlWritet based on the given writer

Method Detail

checkPending

protected void checkPending()
                     throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
closes the XmlWriter by closing the underlying writer

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
flushes the XmlWriter. Attention: If a closing angle braket is pending, it will be appended before flushing the underlying writer. Thus, after flush attributes cannot be added any longer

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException

write

public void write(char c)
           throws java.io.IOException
writes a single character using the xml escaping rules

Throws:
java.io.IOException

write

public void write(char[] buf,
                  int start,
                  int len)
           throws java.io.IOException
writes an character array using the XML escaping rules

Specified by:
write in class java.io.Writer
Throws:
java.io.IOException

writeIndent

public void writeIndent()
                 throws java.io.IOException
Throws:
java.io.IOException

attribute

public void attribute(java.lang.String name,
                      java.lang.String value)
               throws java.io.IOException
writes a degenerated tag with the given name and attributes

Specified by:
attribute in class AbstractXmlWriter
Throws:
java.io.IOException

startTag

protected void startTag(PrefixMap prefixMap,
                        java.lang.String tag)
                 throws java.io.IOException
writes a start tag with the given name

Specified by:
startTag in class AbstractXmlWriter
Throws:
java.io.IOException

endTag

public void endTag()
            throws java.io.IOException
writes an end tag.

Specified by:
endTag in class AbstractXmlWriter
Throws:
java.io.IOException

writeLegacy

public void writeLegacy(int type,
                        java.lang.String content)
                 throws java.io.IOException
ATTENTION: Application needs to take care about not writing illegal character sequences (like comment end in comments)

Specified by:
writeLegacy in class AbstractXmlWriter
Throws:
java.io.IOException

writeRaw

public void writeRaw(java.lang.String s)
              throws java.io.IOException
writes a string without escaping. Use with care! Not available in wbxml writer

Throws:
java.io.IOException