1 | |
package org.jtheque.films.services.impl.utils.file.jt.reader; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
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 | |
|
32 | |
|
33 | |
|
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 | |
} |