org.parancoe.yaml
Class YamlDecoder

java.lang.Object
  extended by org.parancoe.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.File file)
          Creates a YamlDecoder that reads from specifed file.
YamlDecoder(java.io.InputStream in)
          Creates a YamlDecoder that reads from specified stream.
YamlDecoder(java.lang.String filename)
          Creates a YamlDecoder that reads from specifed file.
 
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
clone, equals, finalize, 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.File file)
            throws java.io.FileNotFoundException
Creates a YamlDecoder that reads from specifed file.

Parameters:
file - file to read from.
Throws:
java.io.FileNotFoundException

YamlDecoder

public YamlDecoder(java.lang.String filename)
            throws java.io.FileNotFoundException
Creates a YamlDecoder that reads from specifed file.

Parameters:
filename - name of file to read from.
Throws:
java.io.FileNotFoundException
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


Copyright © 2007 JUG Padova Parancoe Team. All Rights Reserved.