org.ho.yaml
Class YamlEncoder

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

public class YamlEncoder
extends java.lang.Object

YamlEncoder - The usage of YamlEncoder mirrors that of java.beans.XMLEncoder. You create an encoder, make some calls to writeObject, and then close the encoder. 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
YamlEncoder(java.io.OutputStream out)
          Creates a YamlEncoder writing to specifed stream.
YamlEncoder(java.io.OutputStream out, YamlConfig config)
          Creates a YamlEncoder writing to specifed stream.
 
Method Summary
 void close()
          Closes this YamlEncoder instance.
 void flush()
          Flushes the outputStream that this YamlEncoder points to.
 YamlConfig getConfig()
           
 java.lang.String getIndentAmount()
          Returns the indentation amount used for one indentation level.
 boolean isMinimalOutput()
          Returns whether the minimal output option is set.
 void setConfig(YamlConfig config)
           
 void setIndentAmount(java.lang.String indentAmount)
          Sets indentation amount.
 void setMinimalOutput(boolean minimalOutput)
          Sets the minimal output option.
 void writeObject(java.lang.Object obj)
          Write an object to the stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YamlEncoder

public YamlEncoder(java.io.OutputStream out)
Creates a YamlEncoder writing to specifed stream.

Parameters:
out - the output stream to write to.

YamlEncoder

public YamlEncoder(java.io.OutputStream out,
                   YamlConfig config)
Creates a YamlEncoder writing to specifed stream.

Parameters:
out - the output stream to write to.
config - the YAML config
Method Detail

getIndentAmount

public java.lang.String getIndentAmount()
Returns the indentation amount used for one indentation level.

Returns:
the amount of indentation used for one indentation level.

setIndentAmount

public void setIndentAmount(java.lang.String indentAmount)
Sets indentation amount.

Parameters:
indentAmount - must be a string consisting only of spaces.

isMinimalOutput

public boolean isMinimalOutput()
Returns whether the minimal output option is set.

Returns:
whether the minimal output option is set.

setMinimalOutput

public void setMinimalOutput(boolean minimalOutput)
Sets the minimal output option.

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

writeObject

public void writeObject(java.lang.Object obj)
Write an object to the stream.

Parameters:
obj - object to write.

close

public void close()
Closes this YamlEncoder instance. This must be done after a write sequence for the write to be effective.


flush

public void flush()
Flushes the outputStream that this YamlEncoder points to.


getConfig

public YamlConfig getConfig()
Returns:
the config object for this encoder.

setConfig

public void setConfig(YamlConfig config)
Parameters:
config - the new config object for this encoder.