org.kxml.wap
Class WbxmlWriter

java.lang.Object
  extended by java.io.Writer
      extended by org.kxml.io.AbstractXmlWriter
          extended by org.kxml.wap.WbxmlWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable
Direct Known Subclasses:
WmlWriter

public class WbxmlWriter
extends AbstractXmlWriter

a class for converting ("binary encoding") XML to WBXML. Todo:


Field Summary
 
Fields inherited from class org.kxml.io.AbstractXmlWriter
current
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
WbxmlWriter(java.io.OutputStream out)
           
 
Method Summary
 void attribute(java.lang.String name, java.lang.String value)
          writes an attribute.
 void checkPending(boolean degenerated)
           
 void close()
           
 void endTag()
          Abstract method for writing an end tag.
 void flush()
          ATTENTION: flush cannot work since Wbxml documents cannot need buffering.
 void setAttrStartTable(int page, java.lang.String[] attrStartTable)
          Sets the attribute start Table for a given page.
 void setAttrValueTable(int page, java.lang.String[] attrValueTable)
          Sets the attribute value Table for a given page.
 void setTagTable(int page, java.lang.String[] tagTable)
          Sets the tag table for a given page.
 void startTag(PrefixMap prefixMap, java.lang.String name)
          abstract method that must be overwritten by a method actually writing the resolved start tag without namespace checking.
 void write(char[] chars, int start, int len)
           
 void writeLegacy(int type, java.lang.String data)
          currently ignored!
 
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
 

Constructor Detail

WbxmlWriter

public WbxmlWriter(java.io.OutputStream out)
            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

flush

public void flush()
ATTENTION: flush cannot work since Wbxml documents cannot need buffering. Thus, this call does nothing.

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

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

checkPending

public void checkPending(boolean degenerated)
                  throws java.io.IOException
Throws:
java.io.IOException

startTag

public void startTag(PrefixMap prefixMap,
                     java.lang.String name)
              throws java.io.IOException
Description copied from class: AbstractXmlWriter
abstract method that must be overwritten by a method actually writing the resolved start tag without namespace checking. This implementation just puts the state on the stack.

Attention: The actual implementation include the following line in order to put the current State on the stack!

current = new State (current, prefixMap, tag);

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

attribute

public void attribute(java.lang.String name,
                      java.lang.String value)
Description copied from class: AbstractXmlWriter
writes an attribute. Only allowed immediately after startTag or attribute.

Specified by:
attribute in class AbstractXmlWriter

write

public void write(char[] chars,
                  int start,
                  int len)
           throws java.io.IOException
Specified by:
write in class java.io.Writer
Throws:
java.io.IOException

endTag

public void endTag()
            throws java.io.IOException
Description copied from class: AbstractXmlWriter
Abstract method for writing an end tag. Attention: Concrete implementations must pop the previous stack from the stack:

current = current.prev;

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

writeLegacy

public void writeLegacy(int type,
                        java.lang.String data)
currently ignored!

Specified by:
writeLegacy in class AbstractXmlWriter

setTagTable

public void setTagTable(int page,
                        java.lang.String[] tagTable)
Sets the tag table for a given page. The first string in the array defines tag 5, the second tag 6 etc. Currently, only page 0 is supported


setAttrStartTable

public void setAttrStartTable(int page,
                              java.lang.String[] attrStartTable)
Sets the attribute start Table for a given page. The first string in the array defines attribute 5, the second attribute 6 etc. Currently, only page 0 is supported. Please use the character '=' (without quote!) as delimiter between the attribute name and the (start of the) value


setAttrValueTable

public void setAttrValueTable(int page,
                              java.lang.String[] attrValueTable)
Sets the attribute value Table for a given page. The first string in the array defines attribute value 0x85, the second attribute value 0x86 etc. Currently, only page 0 is supported.