Coverage Report - org.jtheque.films.services.impl.utils.file.jt.reader.JTZippedFileReader
 
Classes in this File Line Coverage Branch Coverage Complexity
JTZippedFileReader
0 %
0/11
N/A
2.333
 
 1  
 package org.jtheque.films.services.impl.utils.file.jt.reader;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.Managers;
 20  
 import org.jtheque.core.managers.log.ILoggingManager;
 21  
 import org.jtheque.core.utils.file.jt.able.IJTFileReader;
 22  
 import org.jtheque.core.utils.file.jt.able.JTFile;
 23  
 import org.jtheque.utils.io.FileException;
 24  
 
 25  
 import java.io.BufferedInputStream;
 26  
 import java.io.File;
 27  
 import java.io.FileInputStream;
 28  
 import java.io.FileNotFoundException;
 29  
 
 30  
 /**
 31  
  * A reader for zipped JT File.
 32  
  *
 33  
  * @author Baptiste Wicht
 34  
  */
 35  0
 public abstract class JTZippedFileReader implements IJTFileReader {
 36  
     @Override
 37  
     public final JTFile readFile(File file) throws FileException {
 38  
         try {
 39  0
             return readFile(new FileInputStream(file));
 40  0
         } catch (FileNotFoundException e) {
 41  0
             throw new FileException(e);
 42  
         }
 43  
     }
 44  
 
 45  
     @Override
 46  
     public final JTFile readFile(String path) throws FileException {
 47  0
         return readFile(new File(path));
 48  
     }
 49  
 
 50  
     @Override
 51  
     public final JTFile readFile(FileInputStream stream) throws FileException {
 52  0
         JTFile file = null;
 53  
 
 54  
         try {
 55  0
             file = readFile(new BufferedInputStream(stream));
 56  0
         } catch (FileException e) {
 57  0
             Managers.getManager(ILoggingManager.class).getLogger(getClass()).error(e);
 58  0
         }
 59  
 
 60  0
         return file;
 61  
     }
 62  
 }