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.


Field Summary
static java.lang.String[] FILE_ENDINGS
           
private  java.lang.String id
           
static java.lang.String MOD_DESCRIPTOR_FILE
           
private  java.lang.String parent
           
static java.lang.String SPECIFICATION_FILE
           
 
Constructor Summary
FreeColModFile(java.io.File file)
          Make a FreeColModFile from a File.
 
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.
private  java.io.InputStream getModDescriptorInputStream()
          Gets the input stream to the mod meta file.
 java.lang.String getParent()
          Gets the parent of the mod.
 Specification getSpecification()
          Returns the Specification of this Mod.
 java.io.InputStream getSpecificationInputStream()
          Gets the input stream to the specification.
protected  void readModDescriptor()
          Reads a file object representing this mod.
 
Methods inherited from class net.sf.freecol.common.io.FreeColDataFile
getFileFilter, getFileNames, 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

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

MOD_DESCRIPTOR_FILE

public 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

parent

private java.lang.String parent
Constructor Detail

FreeColModFile

public FreeColModFile(java.io.File file)
               throws java.io.IOException
Make a FreeColModFile from a File.

Parameters:
file - The File containing a FreeCol mod.
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.

getSpecification

public Specification getSpecification()
                               throws java.io.IOException
Returns the Specification of this Mod.

Returns:
a Specification value
Throws:
java.io.IOException - if an error occurs

readModDescriptor

protected void readModDescriptor()
                          throws java.io.IOException
Reads a file object representing this mod.

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.

getParent

public java.lang.String getParent()
Gets the parent of the mod.

Returns:
a String value