org.ho.yaml
Class YamlDecoder

java.lang.Object
  extended by org.ho.yaml.YamlDecoder

public class YamlDecoder
extends java.lang.Object

YamlDecoder - The usage of YamlDecoder mirrors that of java.beans.XMLDecoder. You create a decoder, make some calls to readObject, and then close the decoder. In most cases you may find it is not necessary to access this class directly as Yaml contain methods for the most common usages. The utility functions that were previously in this class are now in Yaml.


Constructor Summary
YamlDecoder(java.io.InputStream in)
          Creates a YamlDecoder that reads from specified stream.
YamlDecoder(java.io.Reader reader)
          Creates a YamlDecoder that reads from specifed reader.
YamlDecoder(java.io.Reader reader, YamlConfig config)
          Creates a YamlDecoder that reads from specifed reader and YAML config.
 
Method Summary
 YamlStream asStream()
           
<T> YamlStream
asStreamOfType(java.lang.Class<T> clazz)
           
 void close()
          Closes this decoder instance.
 YamlConfig getConfig()
          returns the Jyaml configuration for this Decoder
 boolean isSuppressWarnings()
          returns whether the suppress warnings option is on
 java.lang.Object readObject()
          Reads one object from the Yaml stream.
<T> T
readObjectOfType(java.lang.Class<T> clazz)
          Returns the next object from the Yaml stream given the expected type.
 void setConfig(YamlConfig config)
          set the Jyaml configuration for this decoder
 void setSuppressWarnings(boolean suppressWarnings)
          sets the suppress warnings option
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YamlDecoder

public YamlDecoder(java.io.InputStream in)
Creates a YamlDecoder that reads from specified stream.

Parameters:
in - InputStream to read from.

YamlDecoder

public YamlDecoder(java.io.Reader reader)
Creates a YamlDecoder that reads from specifed reader.

Parameters:
reader - Reader to read from

YamlDecoder

public YamlDecoder(java.io.Reader reader,
                   YamlConfig config)
Creates a YamlDecoder that reads from specifed reader and YAML config.

Parameters:
reader - reader to read from
config - YAML config
Method Detail

readObject

public java.lang.Object readObject()
                            throws java.io.EOFException
Reads one object from the Yaml stream.

Returns:
the next object in the Yaml stream.
Throws:
java.io.EOFException - - if the end of the Yaml stream has been reached.

asStreamOfType

public <T> YamlStream asStreamOfType(java.lang.Class<T> clazz)

asStream

public YamlStream asStream()

readObjectOfType

public <T> T readObjectOfType(java.lang.Class<T> clazz)
                   throws java.io.EOFException
Returns the next object from the Yaml stream given the expected type.

Type Parameters:
T - The type of the object expected.
Parameters:
clazz - the class representing the type of the object expected.
Returns:
next object from the Yaml stream given the expected type.
Throws:
java.io.EOFException

close

public void close()
Closes this decoder instance.


isSuppressWarnings

public boolean isSuppressWarnings()
returns whether the suppress warnings option is on

Returns:
whether the suppress warnings option is on

setSuppressWarnings

public void setSuppressWarnings(boolean suppressWarnings)
sets the suppress warnings option

Parameters:
suppressWarnings - true for on; false for off.

getConfig

public YamlConfig getConfig()
returns the Jyaml configuration for this Decoder

Returns:
a YamlConfig

setConfig

public void setConfig(YamlConfig config)
set the Jyaml configuration for this decoder

Parameters:
config - the config object to set