megamek.common.util
Interface ItemFileFactory

All Superinterfaces:
java.io.FilenameFilter
All Known Implementing Classes:
ImageFileFactory, ImageFileFactory

public interface ItemFileFactory
extends java.io.FilenameFilter

This interface represents a factory that can produce items from cate- gorizable files. This interface extends the FilenameFilter, so the factory is aware of the files that it can handle as input. Created on January 18, 2004

Version:
1
Author:
James Damour

Method Summary
 boolean accept(java.io.File dir, java.lang.String name)
          The method that must be implemented by any object that filters filenames (i.e., selects a subset of filenames from a list of filenames).
 boolean accept(java.util.zip.ZipFile zipFile, java.lang.String name)
          The method that must be implemented by any object that filters filenames within a ZipFile (i.e., selects a subset of filenames from a list of filenames in a ZIP archive).
 ItemFile getItemFile(java.io.File file)
          Get the ItemFile for the given File.
 ItemFile getItemFile(java.util.zip.ZipEntry entry, java.util.zip.ZipFile zipFile)
          Get the ItemFile for the given ZipEntry in the ZipFile.
 

Method Detail

getItemFile

ItemFile getItemFile(java.io.File file)
                     throws java.lang.IllegalArgumentException
Get the ItemFile for the given File.

Parameters:
file - - the input File object that will be read to produce the item. This value must not be null.
Returns:
an ItemFile for the given file.
Throws:
IllegalArgumentException - if the file is null.
java.lang.IllegalArgumentException

getItemFile

ItemFile getItemFile(java.util.zip.ZipEntry entry,
                     java.util.zip.ZipFile zipFile)
                     throws java.lang.IllegalArgumentException
Get the ItemFile for the given ZipEntry in the ZipFile.

Parameters:
zipEntry - - the ZipEntry that will be read to produce the item. This value must not be null.
zipFile - - the ZipFile object that contains the ZipEntry that will produce the item. This value must not be null.
Returns:
an ItemFile for the given zip file entry.
Throws:
IllegalArgumentException - if the file is null.
java.lang.IllegalArgumentException

accept

boolean accept(java.io.File dir,
               java.lang.String name)
The method that must be implemented by any object that filters filenames (i.e., selects a subset of filenames from a list of filenames).

This definition is copied from java.io.FilenameFilter for completeness.

Specified by:
accept in interface java.io.FilenameFilter
Parameters:
dir - - the File object of the directory containing the named file.
name - - the String name of the file.

accept

boolean accept(java.util.zip.ZipFile zipFile,
               java.lang.String name)
The method that must be implemented by any object that filters filenames within a ZipFile (i.e., selects a subset of filenames from a list of filenames in a ZIP archive).

Parameters:
zipFile - - the ZipFile object that contains the named file's entry.
name - - the String name of the file.