Package net.sf.freecol.common.io
Class FreeColSavegameFile
- java.lang.Object
-
- net.sf.freecol.common.io.FreeColDataFile
-
- net.sf.freecol.common.io.FreeColSavegameFile
-
public class FreeColSavegameFile extends FreeColDataFile
Represents a FreeCol savegame.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLIENT_OPTIONS
The name of the file that contains theClientOptions
saved with the game.static java.lang.String
SAVEGAME_FILE
The name of the file that contains the actual savegame.static java.lang.String
SAVEGAME_PROPERTIES
The name of a properties file that contains information about the saved game, such as the size of the map, the date and time it was started, and so on.static java.lang.String
THUMBNAIL_FILE
The name of the image file that contains the map thumbnail, i.e.static java.lang.String
VERSION_TAG
The tag for the version string in the saved game.private static java.util.List<java.lang.String>
versionList
Static argument list for getVersion.-
Fields inherited from class net.sf.freecol.common.io.FreeColDataFile
ZIP_FILE_EXTENSION
-
-
Constructor Summary
Constructors Constructor Description FreeColSavegameFile(java.io.File file)
Create a new save game file from a given file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FreeColXMLReader
getClientOptionsFreeColXMLReader()
Get a reader for the client options data.java.util.Properties
getProperties()
Get the properties in this save game.FreeColXMLReader
getSavedGameFreeColXMLReader()
Get a reader for the saved game data.java.io.BufferedInputStream
getSavegameInputStream()
Gets the input stream to the saved game data.int
getSavegameVersion()
Gets the save game version from this saved game.java.io.BufferedInputStream
getThumbnailInputStream()
Gets the input stream to the thumbnail file.java.util.List<java.lang.String>
peekAttributes(java.util.List<java.lang.String> attributes)
Peek at the attributes in a saved game.-
Methods inherited from class net.sf.freecol.common.io.FreeColDataFile
getFileFilter, getInputStream, getPath, getResourceMapping, getURI
-
-
-
-
Field Detail
-
VERSION_TAG
public static final java.lang.String VERSION_TAG
The tag for the version string in the saved game.- See Also:
- Constant Field Values
-
SAVEGAME_FILE
public static final java.lang.String SAVEGAME_FILE
The name of the file that contains the actual savegame.- See Also:
- Constant Field Values
-
SAVEGAME_PROPERTIES
public static final java.lang.String SAVEGAME_PROPERTIES
The name of a properties file that contains information about the saved game, such as the size of the map, the date and time it was started, and so on. The map size is used in theMapGeneratorOptionsDialog
, for example.- See Also:
- Constant Field Values
-
CLIENT_OPTIONS
public static final java.lang.String CLIENT_OPTIONS
The name of the file that contains theClientOptions
saved with the game.- See Also:
- Constant Field Values
-
THUMBNAIL_FILE
public static final java.lang.String THUMBNAIL_FILE
The name of the image file that contains the map thumbnail, i.e. a view of the game map as seen by the owner of the game when saving. The thumbnail image is used byMapGeneratorOptionsDialog
..- See Also:
- Constant Field Values
-
versionList
private static final java.util.List<java.lang.String> versionList
Static argument list for getVersion.
-
-
Method Detail
-
peekAttributes
public java.util.List<java.lang.String> peekAttributes(java.util.List<java.lang.String> attributes) throws java.io.IOException, javax.xml.stream.XMLStreamException
Peek at the attributes in a saved game.- Parameters:
attributes
- A list of attribute names to peek at.- Returns:
- A list of corresponding attribute values, or null on error.
- Throws:
java.io.IOException
- if there is a problem reading the attributes.javax.xml.stream.XMLStreamException
- on stream error.
-
getProperties
public java.util.Properties getProperties() throws java.io.IOException
Get the properties in this save game.- Returns:
- The
Properties
found. - Throws:
java.io.IOException
- if there is a problem reading the properties.
-
getSavegameVersion
public int getSavegameVersion() throws java.io.IOException, javax.xml.stream.XMLStreamException
Gets the save game version from this saved game.- Returns:
- The saved game version, or negative on error.
- Throws:
java.io.IOException
- if there is a problem reading the attributes.javax.xml.stream.XMLStreamException
- on stream error.
-
getSavegameInputStream
public java.io.BufferedInputStream getSavegameInputStream() throws java.io.IOException
Gets the input stream to the saved game data. Only still needed by the validator.- Returns:
- An
InputStream
to the save game file within this data file. - Throws:
java.io.IOException
- if there is a problem opening the input stream.
-
getThumbnailInputStream
public java.io.BufferedInputStream getThumbnailInputStream() throws java.io.IOException
Gets the input stream to the thumbnail file.- Returns:
- An
InputStream
to the thumbnail file within this data file. - Throws:
java.io.IOException
- if there is a problem opening the input stream.
-
getClientOptionsFreeColXMLReader
public FreeColXMLReader getClientOptionsFreeColXMLReader() throws java.io.IOException, javax.xml.stream.XMLStreamException
Get a reader for the client options data.- Returns:
- A reader for the file "client-options.xml" within this file.
- Throws:
java.io.IOException
- if there is a problem opening the input stream.javax.xml.stream.XMLStreamException
- if there is a problem creating the reader.
-
getSavedGameFreeColXMLReader
public FreeColXMLReader getSavedGameFreeColXMLReader() throws java.io.IOException, javax.xml.stream.XMLStreamException
Get a reader for the saved game data.- Returns:
- A reader for the file "savegame.xml" within this file.
- Throws:
java.io.IOException
- if there is a problem opening the input stream.javax.xml.stream.XMLStreamException
- if there is a problem creating the reader.
-
-