Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
JTDFile |
|
| 1.0;1 |
1 | package org.jtheque.core.utils.file.jt.impl; | |
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.utils.file.jt.AbstractJTFileHeader; | |
20 | import org.jtheque.core.utils.file.jt.able.JTNotZippedFile; | |
21 | ||
22 | import java.io.DataInputStream; | |
23 | ||
24 | /** | |
25 | * A JTD File. | |
26 | * | |
27 | * @author Baptiste Wicht | |
28 | */ | |
29 | public final class JTDFile implements JTNotZippedFile { | |
30 | //Correct separators | |
31 | private boolean correctSeparators; | |
32 | ||
33 | private DataInputStream stream; | |
34 | ||
35 | //Header | |
36 | private AbstractJTFileHeader header; | |
37 | ||
38 | /** | |
39 | * Construct a new JTDFile. | |
40 | */ | |
41 | public JTDFile() { | |
42 | 0 | super(); |
43 | ||
44 | 0 | header = new JTDFileHeader(); |
45 | 0 | } |
46 | ||
47 | @Override | |
48 | public AbstractJTFileHeader getHeader() { | |
49 | 0 | return header; |
50 | } | |
51 | ||
52 | /** | |
53 | * Set the header of the file. | |
54 | * | |
55 | * @param header The new header to set. | |
56 | */ | |
57 | void setHeader(AbstractJTFileHeader header) { | |
58 | 0 | this.header = header; |
59 | 0 | } |
60 | ||
61 | /** | |
62 | * Return the stream to the file. | |
63 | * | |
64 | * @return The stream to the file. | |
65 | */ | |
66 | public DataInputStream getStream() { | |
67 | 0 | return stream; |
68 | } | |
69 | ||
70 | /** | |
71 | * Set the stream. | |
72 | * | |
73 | * @param stream The stream to the file. | |
74 | */ | |
75 | public void setStream(DataInputStream stream) { | |
76 | 0 | this.stream = stream; |
77 | 0 | } |
78 | ||
79 | @Override | |
80 | public boolean isValid() { | |
81 | 0 | return header.isComplete(); |
82 | } | |
83 | ||
84 | @Override | |
85 | public void setCorrectSeparators(boolean correctSeparators) { | |
86 | 0 | this.correctSeparators = correctSeparators; |
87 | 0 | } |
88 | ||
89 | @Override | |
90 | public boolean isCorrectSeparators() { | |
91 | 0 | return correctSeparators; |
92 | } | |
93 | } |