Search this API

y.io.gml
Class GMLEncoder

java.lang.Object
  extended by y.io.gml.GMLEncoder
Direct Known Subclasses:
XGMLEncoder

public class GMLEncoder
extends java.lang.Object

This class is a utility class for writing valid GML to a Writer

 

Constructor Summary
GMLEncoder(java.io.Writer writer)
          Creates a new instance of GMLEncoder
 
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 addAttributes(java.lang.String key, java.lang.String itemName, java.util.Collection items)
          Writes a named collection to the file by calling addAttribute(String, Object) for each entry in items.
 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 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.
protected  void writeIndentation()
          Writes the current indentation to the writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GMLEncoder

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

Method Detail

writeIndentation

protected void writeIndentation()
                         throws java.io.IOException
Writes the current indentation to the writer.

Throws:
java.io.IOException

beginSection

public void beginSection(java.lang.String sectionName)
                  throws java.io.IOException
Writes the start tag for a given section.

Throws:
java.io.IOException

writeAttribute

protected void writeAttribute(java.lang.String key,
                              java.lang.String value)
                       throws java.io.IOException
Writes a key value pair, where the value is a string.

Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         double value)
                  throws java.io.IOException
Writes a key value pair, where the value is a double.

Throws:
java.io.IOException

addAttribute

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

Throws:
java.io.IOException

addAttribute

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

Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         boolean value)
                  throws java.io.IOException
Writes a key value pair, where the value is a boolean value.

Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         java.lang.String value)
                  throws java.io.IOException
Writes a key value pair, where the value is a string.

Throws:
java.io.IOException

addAttribute

public void addAttribute(java.lang.String key,
                         java.lang.Object value)
                  throws java.io.IOException
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.

Throws:
java.io.IOException

addAttributes

public void addAttributes(java.lang.String key,
                          java.lang.String itemName,
                          java.util.Collection items)
                   throws java.io.IOException
Writes a named collection to the file by calling addAttribute(String, Object) for each entry in items.

Throws:
java.io.IOException

sanatize

protected java.lang.String sanatize(java.lang.String s)
Encodes the string to be valid GML, escaping invalid characters accordingly.


endSection

public void endSection()
                throws java.io.IOException
Writes the closing tag for a section opened with beginSection(String)

Throws:
java.io.IOException

getLevel

public int getLevel()
Getter for property level.

Returns:
Value of property level.

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