net.sf.freecol.tools
Class FSGConverter

java.lang.Object
  extended by net.sf.freecol.tools.FSGConverter

public class FSGConverter
extends java.lang.Object

Class for converting FreeCol Savegames (fsg-files).

See Also:
getFSGConverter()

Method Summary
 void convertToXML(java.io.File in, java.io.File out)
          Converts the given input file to an uncompressed and indented XML-file.
 void convertToXML(java.io.InputStream in, java.io.OutputStream out)
          Converts the data from the given input stream to an uncompressed and indented text to the output stream.
static FSGConverter getFSGConverter()
          Gets an object for converting FreeCol Savegames.
static void main(java.lang.String[] args)
          An entry point for converting FreeCol Savegames.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFSGConverter

public static FSGConverter getFSGConverter()
Gets an object for converting FreeCol Savegames.

Returns:
The singleton object.

convertToXML

public void convertToXML(java.io.File in,
                         java.io.File out)
                  throws java.io.FileNotFoundException,
                         java.io.IOException
Converts the given input file to an uncompressed and indented XML-file.

Savegame compression is automatically detected, so using this method on an uncompressed savegame creates an indented version of that savegame.

Parameters:
in - The input file.
out - The output file. This file will be overwritten if it already exists.
Throws:
java.io.FileNotFoundException - if the given input file could not be found.
java.io.IOException - if thrown while reading or writing the files.

convertToXML

public void convertToXML(java.io.InputStream in,
                         java.io.OutputStream out)
                  throws java.io.IOException
Converts the data from the given input stream to an uncompressed and indented text to the output stream. Both streams are closed by this method.

Savegame compression is automatically detected, so using this method on an uncompressed savegame creates an indented version of that savegame.

Parameters:
in - The input stream.
out - The output stream.
Throws:
java.io.IOException - if thrown while reading or writing the streams.

main

public static void main(java.lang.String[] args)
An entry point for converting FreeCol Savegames.

Parameters:
args - The command-line parameters.