megamek.common.xml
Class GunEmplacementEncoder

java.lang.Object
  extended by megamek.common.xml.GunEmplacementEncoder

public class GunEmplacementEncoder
extends java.lang.Object

Objects of this class can encode a Entity 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:
Mike Gratton

Constructor Summary
GunEmplacementEncoder()
           
 
Method Summary
static Entity decode(gd.xml.tiny.ParsedXML node, IGame game)
          Decode a Entity object from the passed node.
static void encode(Entity entity, java.io.Writer out)
          Encode a Entity object to an output writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GunEmplacementEncoder

public GunEmplacementEncoder()
Method Detail

encode

public static void encode(Entity entity,
                          java.io.Writer out)
                   throws java.io.IOException
Encode a Entity object to an output writer.

Parameters:
entity - - the Entity to be encoded. This value must not be null.
out - - the Writer that will receive the XML. This value must not be null.
Throws:
IOException - if there's any error on write.
java.io.IOException

decode

public static Entity decode(gd.xml.tiny.ParsedXML node,
                            IGame game)
Decode a Entity object from the passed node.

Parameters:
node - - the ParsedXML node for this object. This value must not be null.
game - - the IGame the decoded object belongs to.
Returns:
the Entity object based on the node.
Throws:
IllegalStateException - if the node does not contain a valid Entity.