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.impl.bzip2;
020    
021    import com.mucommander.file.AbstractArchiveFile;
022    import com.mucommander.file.AbstractFile;
023    import com.mucommander.file.ArchiveFormatProvider;
024    import com.mucommander.file.filter.ExtensionFilenameFilter;
025    import com.mucommander.file.filter.FilenameFilter;
026    
027    import java.io.IOException;
028    
029    /**
030     * This class is the provider for the 'Bzip2' archive format implemented by {@link Bzip2ArchiveFile}.
031     *
032     * @see com.mucommander.file.impl.bzip2.Bzip2ArchiveFile
033     * @author Nicolas Rinaudo, Maxence Bernard
034     */
035    public class Bzip2FormatProvider implements ArchiveFormatProvider {
036    
037        /** Static instance of the filename filter that matches archive filenames */
038        private final static ExtensionFilenameFilter filenameFilter = new ExtensionFilenameFilter(".bz2");
039    
040    
041        //////////////////////////////////////////
042        // ArchiveFormatProvider implementation //
043        //////////////////////////////////////////
044    
045        public AbstractArchiveFile getFile(AbstractFile file) throws IOException {
046            return new Bzip2ArchiveFile(file);
047        }
048    
049        public FilenameFilter getFilenameFilter() {
050            return filenameFilter;
051        }
052    }