Search this API

y.io.gml
Class XGMLEncoder

java.lang.Object
  extended by y.io.gml.GMLEncoder
      extended by y.io.gml.XGMLEncoder

public class XGMLEncoder
extends GMLEncoder

This class is a utility class for writing a simple XML-ish version of valid GML to a Writer. Each section is represented in a <section> tag and each attribute in an <attribute> tag.

 

Constructor Summary
XGMLEncoder(java.io.Writer writer)
          Creates a new instance of XGMLEncoder.
 
Method Summary
 void addAttribute(java.lang.String key, boolean value)
          Writes a key value pair, where the value is a boolean value.
 void addAttribute(java.lang.String key, double value)
          Writes a key value pair, where the value is a double.
 void addAttribute(java.lang.String key, int value)
          Writes a key value pair, where the value is an integer.
 void addAttribute(java.lang.String key, java.lang.Number value)
          Writes a key value pair, where the value is a Number in String format.
 void addAttribute(java.lang.String key, java.lang.Object value)
          Writes a key value pair, where the value is an object.
 void addAttribute(java.lang.String key, java.lang.String value)
          Writes a key value pair, where the value is a string.
 void beginSection(java.lang.String sectionName)
          Writes the start tag for a given section.
 void endSection()
          Writes the closing tag for a section opened with GMLEncoder.beginSection(String)
 int getLevel()
          Getter for property level.
protected  java.lang.String sanatize(java.lang.String s)
          Encodes the string to be valid GML, escaping invalid characters accordingly.
protected  void writeAttribute(java.lang.String key, java.lang.String value)
          Writes a key value pair, where the value is a string.
 
Methods inherited from class y.io.gml.GMLEncoder
addAttributes, writeIndentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XGMLEncoder

public XGMLEncoder(java.io.Writer writer)
Creates a new instance of XGMLEncoder.

Method Detail

beginSection

public void beginSection(java.lang.String sectionName)
                  throws java.io.IOException
Description copied from class: GMLEncoder
Writes the start tag for a given section.

Overrides:
beginSection in class GMLEncoder
Throws:
java.io.IOException

writeAttribute

protected void writeAttribute(java.lang.String key,
                              java.lang.String value)
                       throws java.io.IOException
Description copied from class: GMLEncoder
Writes a key value pair, where the value is a string.

Overrides:
writeAttribute in class GMLEncoder
Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         double value)
                  throws java.io.IOException
Description copied from class: GMLEncoder
Writes a key value pair, where the value is a double.

Overrides:
addAttribute in class GMLEncoder
Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         int value)
                  throws java.io.IOException
Description copied from class: GMLEncoder
Writes a key value pair, where the value is an integer.

Overrides:
addAttribute in class GMLEncoder
Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         java.lang.Number value)
                  throws java.io.IOException
Description copied from class: GMLEncoder
Writes a key value pair, where the value is a Number in String format.

Overrides:
addAttribute in class GMLEncoder
Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         boolean value)
                  throws java.io.IOException
Description copied from class: GMLEncoder
Writes a key value pair, where the value is a boolean value.

Overrides:
addAttribute in class GMLEncoder
Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         java.lang.String value)
                  throws java.io.IOException
Description copied from class: GMLEncoder
Writes a key value pair, where the value is a string.

Overrides:
addAttribute in class GMLEncoder
Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         java.lang.Object value)
                  throws java.io.IOException
Description copied from class: GMLEncoder
Writes a key value pair, where the value is an object. This implementation determines what method to use by examining the object's class type.

Overrides:
addAttribute in class GMLEncoder
Throws:
java.io.IOException

sanatize

protected java.lang.String sanatize(java.lang.String s)
Description copied from class: GMLEncoder
Encodes the string to be valid GML, escaping invalid characters accordingly.

Overrides:
sanatize in class GMLEncoder

endSection

public void endSection()
                throws java.io.IOException
Description copied from class: GMLEncoder
Writes the closing tag for a section opened with GMLEncoder.beginSection(String)

Overrides:
endSection in class GMLEncoder
Throws:
java.io.IOException

getLevel

public int getLevel()
Getter for property level.

Overrides:
getLevel in class GMLEncoder
Returns:
Value of property level.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.