com.compomics.util.experiment.io.identifications
Class IdfileReaderFactory

java.lang.Object
  extended by com.compomics.util.experiment.io.identifications.IdfileReaderFactory

public class IdfileReaderFactory
extends java.lang.Object

This factory will provide the appropriate identification file reader for each type of file. Null when the format is not supported.

Author:
Marc Vaudel

Method Summary
 IdfileReader getFileReader(java.io.File aFile, WaitingHandler waitingHandler)
          This method returns the proper identification file reader depending on the format of the provided file.
static IdfileReaderFactory getInstance()
          A static method to retrieve the instance of the factory.
 int getSearchEngine(java.io.File aFile)
          This method return the search engine corresponding to the given file.
static java.lang.Class registerIdFileReader(java.lang.Class aReader, java.lang.String aExtension)
          This method registers a new IdfileReader Class, and the file extension it can read from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static IdfileReaderFactory getInstance()
A static method to retrieve the instance of the factory.

Returns:
the factory instance

registerIdFileReader

public static java.lang.Class registerIdFileReader(java.lang.Class aReader,
                                                   java.lang.String aExtension)
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.

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

public IdfileReader getFileReader(java.io.File aFile,
                                  WaitingHandler waitingHandler)
                           throws org.xml.sax.SAXException,
                                  java.io.FileNotFoundException,
                                  java.io.IOException
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. //@TODO: create parsers using waiting handlers and indexed files.

Parameters:
aFile - the file to parse
waitingHandler - a waiting handler to display the results. Can be null
Returns:
an adapted file reader
Throws:
org.xml.sax.SAXException
java.io.FileNotFoundException
java.io.IOException

getSearchEngine

public int getSearchEngine(java.io.File aFile)
This method return the search engine corresponding to the given file.

Parameters:
aFile - an identification file
Returns:
the index of the search engine


Copyright © 2013. All Rights Reserved.