001    /*
002     * This file is part of muCommander, http://www.mucommander.com
003     * Copyright (C) 2002-2008 Maxence Bernard
004     *
005     * muCommander is free software; you can redistribute it and/or modify
006     * it under the terms of the GNU General Public License as published by
007     * the Free Software Foundation; either version 3 of the License, or
008     * (at your option) any later version.
009     *
010     * muCommander is distributed in the hope that it will be useful,
011     * but WITHOUT ANY WARRANTY; without even the implied warranty of
012     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013     * GNU General Public License for more details.
014     *
015     * You should have received a copy of the GNU General Public License
016     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017     */
018    
019    package com.mucommander.file;
020    
021    import com.mucommander.file.filter.FilenameFilter;
022    
023    import java.io.IOException;
024    
025    /**
026     * This interface allows {@link FileFactory} to instanciate {@link AbstractArchiveFile} implementations and associate
027     * them with the filenames matched by a {@link FilenameFilter}.
028     * <p>
029     * For {@link AbstractArchiveFile} implementations to be automatically instanciated by {@link FileFactory},
030     * this interface needs to be implemented and an instance registered with {@link FileFactory}.
031     * </p>
032     *
033     * @author Nicolas Rinaudo, Maxence Bernard
034     * @see AbstractArchiveFile
035     * @see FileFactory
036     */
037    public interface ArchiveFormatProvider {
038    
039        /**
040         * Creates a new instance of <code>AbstractArchiveFile</code> .
041         *
042         * @param  file        file to map as an <code>AbstractArchiveFile</code>.
043         * @return             a new instance of <code>AbstractArchiveFile</code> that matches the specified URL.
044         * @throws IOException if an error occurs.
045         */
046        public AbstractArchiveFile getFile(AbstractFile file) throws IOException;
047    
048    
049        /**
050         * Returns the <code>FilenameFilter</code> that matches filenames to be associated with this archive format.
051         *
052         * @return the <code>FilenameFilter</code> that matches filenames to be associated with this archive format
053         */
054        public FilenameFilter getFilenameFilter();
055    }