Package net.sf.freecol.tools
Class FSGConverter
- java.lang.Object
-
- net.sf.freecol.tools.FSGConverter
-
public class FSGConverter extends java.lang.ObjectClass for converting FreeCol Savegames (fsg-files).- Since:
- 0.5.2
- See Also:
getFSGConverter()
-
-
Field Summary
Fields Modifier and Type Field Description private static FSGConvertersingletonA singleton object of this class.private static java.lang.ObjectsingletonLock
-
Constructor Summary
Constructors Modifier Constructor Description privateFSGConverter()Creates an instance ofFSGConverter
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidconvertToXML(java.io.File in, java.io.File out)Converts the given input file to an uncompressed and indented XML-file.private voidconvertToXML(java.io.InputStream ins, java.io.OutputStream outs)Converts the data from the given input stream to an uncompressed and indented text to the output stream.static FSGConvertergetFSGConverter()Gets an object for converting FreeCol Savegames.static voidmain(java.lang.String[] args)An entry point for converting FreeCol Savegames.private static voidprintUsage()Prints the usage of this program to standard out.
-
-
-
Field Detail
-
singleton
private static FSGConverter singleton
A singleton object of this class.- See Also:
getFSGConverter()
-
singletonLock
private static java.lang.Object singletonLock
-
-
Method Detail
-
getFSGConverter
public static FSGConverter getFSGConverter()
Gets an object for converting FreeCol Savegames.- Returns:
- The singleton object.
-
convertToXML
private void convertToXML(java.io.File in, java.io.File out) throws java.io.IOExceptionConverts 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.IOException- if thrown while reading or writing the files.
-
convertToXML
private void convertToXML(java.io.InputStream ins, java.io.OutputStream outs) throws java.io.IOExceptionConverts 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:
ins- The input stream.outs- The output stream.- Throws:
java.io.IOException- if thrown while reading or writing the streams.
-
printUsage
private static void printUsage()
Prints the usage of this program to standard out.
-
main
public static void main(java.lang.String[] args)
An entry point for converting FreeCol Savegames.- Parameters:
args- The command-line parameters.
-
-