Class IdfileReaderFactory
java.lang.Object
com.compomics.util.experiment.io.identification.IdfileReaderFactory
This factory will provide the appropriate identification file reader for each
type of file. Null when the format is not supported.
- Author:
- Lennart Martens, Marc Vaudel
-
Method Summary
Modifier and TypeMethodDescriptiongetFileReader(File aFile) This method returns the proper identification file reader depending on the format of the provided file.static IdfileReaderFactoryA static method to retrieve the instance of the factory.static ClassregisterIdFileReader(Class aReader, String aExtension) This method registers a new IdfileReader Class, and the file extension it can read from.
-
Method Details
-
getInstance
A static method to retrieve the instance of the factory.- Returns:
- the factory instance
-
registerIdFileReader
This method registers a new IdfileReader Class, and the file extension it can read from. Note that the collection of IdfileReaders is keyed by this extension, and similar to the java.util.HashMap syntax, a Class is therefore returned if the extension provided already had an associated Class. If the class is not a valid IdfileReader an exception is thrown.- Parameters:
aReader- Class of the IdfileReader to register.aExtension- String with the extension of the file that this IdfileReader implementation can read.- Returns:
- Class with the Class that was already previously registered for this extension, or 'null' if the extension was not yet registered at all.
-
getFileReader
This method returns the proper identification file reader depending on the format of the provided file. It is very important to close the file reader after creation.- Parameters:
aFile- the file to parse- Returns:
- an adapted file reader
-