net.sf.freecol.common.io
Class FreeColModFile

java.lang.Object
  extended by net.sf.freecol.common.io.FreeColDataFile
      extended by net.sf.freecol.common.io.FreeColModFile
Direct Known Subclasses:
FreeColTcFile

public class FreeColModFile
extends FreeColDataFile

A modification.


Nested Class Summary
protected static class FreeColModFile.ModDescriptor
           
static class FreeColModFile.ModInfo
           
 
Field Summary
static java.lang.String[] FILE_ENDINGS
           
private  java.lang.String id
           
private static java.lang.String MOD_DESCRIPTOR_FILE
           
private  FreeColModFile.ModInfo modInfo
           
private static java.lang.String SPECIFICATION_FILE
           
 
Constructor Summary
  FreeColModFile(FreeColModFile.ModInfo mi)
          Opens the given file for reading.
  FreeColModFile(java.lang.String id)
          Opens the given file for reading.
protected FreeColModFile(java.lang.String id, java.io.File file)
          Opens the given file for reading.
 
Method Summary
protected  java.lang.String[] getFileEndings()
          File endings that are supported for this type of data file.
 java.lang.String getId()
          Gets the ID of this mod.
protected  FreeColModFile.ModDescriptor getModDescriptor()
          Returns an object representing this mod.
private  java.io.InputStream getModDescriptorInputStream()
          Gets the input stream to the mod meta file.
 FreeColModFile.ModInfo getModInfo()
           
 java.io.InputStream getSpecificationInputStream()
          Gets the input stream to the specification.
 
Methods inherited from class net.sf.freecol.common.io.FreeColDataFile
getFileFilter, getInputStream, getResourceMapping, getURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPECIFICATION_FILE

private static final java.lang.String SPECIFICATION_FILE
See Also:
Constant Field Values

MOD_DESCRIPTOR_FILE

private static final java.lang.String MOD_DESCRIPTOR_FILE
See Also:
Constant Field Values

FILE_ENDINGS

public static final java.lang.String[] FILE_ENDINGS

id

private java.lang.String id

modInfo

private final FreeColModFile.ModInfo modInfo
Constructor Detail

FreeColModFile

public FreeColModFile(java.lang.String id)
Opens the given file for reading.

Parameters:
id - The id of the mod to load.
Throws:
java.io.IOException - if thrown while opening the file.

FreeColModFile

public FreeColModFile(FreeColModFile.ModInfo mi)
Opens the given file for reading.

Parameters:
mi - An id object.
Throws:
java.io.IOException - if thrown while opening the file.

FreeColModFile

protected FreeColModFile(java.lang.String id,
                         java.io.File file)
Opens the given file for reading.

Parameters:
id - The id of the mod.
file - The file to be read.
Throws:
java.io.IOException - if thrown while opening the file.
Method Detail

getSpecificationInputStream

public java.io.InputStream getSpecificationInputStream()
                                                throws java.io.IOException
Gets the input stream to the specification.

Returns:
An InputStream to the file "specification.xml" within this data file.
Throws:
java.io.IOException - if thrown while opening the input stream.

getModDescriptor

protected FreeColModFile.ModDescriptor getModDescriptor()
                                                 throws java.io.IOException
Returns an object representing this mod.

Returns:
The meta information for this mod file.
Throws:
java.io.IOException - if thrown while reading the "mod.xml" file.

getModDescriptorInputStream

private java.io.InputStream getModDescriptorInputStream()
                                                 throws java.io.IOException
Gets the input stream to the mod meta file.

Returns:
An InputStream to the file "mod.xml" within this data file.
Throws:
java.io.IOException - if thrown while opening the input stream.

getFileEndings

protected java.lang.String[] getFileEndings()
File endings that are supported for this type of data file.

Overrides:
getFileEndings in class FreeColDataFile
Returns:
An array of: ".fmd" and ".zip".

getId

public java.lang.String getId()
Gets the ID of this mod.

Returns:
The ID of the mod.

getModInfo

public FreeColModFile.ModInfo getModInfo()