megamek.common.xml
Class GameOptionsEncoder
java.lang.Object
megamek.common.xml.GameOptionsEncoder
public class GameOptionsEncoder
- extends java.lang.Object
Objects of this class can encode a GameOptions object as XML
into an output writer and decode one from a parsed XML node. It is used when
saving games into a version- neutral format.
- Author:
- James Damour
|
Method Summary |
static GameOptions |
decode(gd.xml.tiny.ParsedXML node,
IGame game)
Decode a GameOptions object from the passed node. |
static void |
encode(GameOptions options,
java.io.Writer output)
Encode a GameOptions object to an output writer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GameOptionsEncoder
public GameOptionsEncoder()
encode
public static void encode(GameOptions options,
java.io.Writer output)
throws java.io.IOException
- Encode a
GameOptions object to an output writer.
- Parameters:
options - - the GameOptions to be encoded. This value
must not be null.out - - the Writer that will receive the XML. This
value must not be null.
- Throws:
IllegalArgumentException - if the node is
null.
IOException - if there's any error on write.
java.io.IOException
decode
public static GameOptions decode(gd.xml.tiny.ParsedXML node,
IGame game)
- Decode a
GameOptions object from the passed node.
- Parameters:
node - - the ParsedXML node for this object. This
value must not be null.game - - the Game the decoded object belongs to.
- Returns:
- the
GameOptions object based on the node.
- Throws:
IllegalArgumentException - if the node is
null.
IllegalStateException - if the node does not contain
a valid GameOptions.