Class FreeColModFile

    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • allMods

        private static final java.util.Map<java.lang.String,​FreeColModFile> allMods
        A cache of all the mods.
      • SPECIFICATION_FILE

        protected static final java.lang.String SPECIFICATION_FILE
        See Also:
        Constant Field Values
      • id

        private java.lang.String id
        The identifier for this mod.
      • parent

        private java.lang.String parent
        The identifier for the parent of this mod, if any.
    • 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, or null if none present.
        Throws:
        java.io.IOException - if thrown while opening the input stream.
      • getSpecification

        public Specification getSpecification()
                                       throws java.io.IOException,
                                              javax.xml.stream.XMLStreamException
        Gets the Specification.
        Returns:
        The Specification, or null if none present.
        Throws:
        java.io.IOException - if an error occurs creating a stream to read.
        javax.xml.stream.XMLStreamException - if there is an error reading the stream.
      • 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.
      • readModDescriptor

        protected final 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.
      • getParent

        public java.lang.String getParent()
        Gets the parent of the mod.
        Returns:
        The mod parent name.
      • getModsList

        public static java.util.List<FreeColModFile> getModsList()
        Get all the standard mods.
        Returns:
        A list of FreeColModFiles holding the mods.
      • getId

        public java.lang.String getId()
        Gets the object identifier of this mod.
        Specified by:
        getId in interface ObjectWithId
        Returns:
        The object identifier of the mod.
      • loadMods

        public static void loadMods()
        Require all mods to be loaded. This must be delayed until the mods directories are defined. User mods are loaded after standard mods to allow user override.
      • getFreeColModFile

        public static FreeColModFile getFreeColModFile​(java.lang.String id)
        Get a mod by id.
        Parameters:
        id - The mod file identifier to look for.
        Returns:
        The FreeColModFile found, or null if none present.