1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.velocity.tools.nio; |
21 |
|
|
22 |
|
import java.io.BufferedReader; |
23 |
|
import java.io.IOException; |
24 |
|
import java.nio.charset.Charset; |
25 |
|
import java.nio.file.DirectoryStream; |
26 |
|
import java.nio.file.Files; |
27 |
|
import java.nio.file.LinkOption; |
28 |
|
import java.nio.file.Path; |
29 |
|
import java.nio.file.attribute.FileTime; |
30 |
|
import java.util.List; |
31 |
|
import java.util.Map; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 10% |
Uncovered Elements: 45 (50) |
Complexity: 25 |
Complexity Density: 0.71 |
|
39 |
|
public class NIOTool |
40 |
|
{ |
41 |
|
|
42 |
|
@link |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
@param@link |
53 |
|
@return@link |
54 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
55 |
2 |
public DirectoryStream<Path> newDirectoryStream(Path dir)... |
56 |
|
{ |
57 |
2 |
try { |
58 |
2 |
return new WrappingDirectoryStream(Files.newDirectoryStream(dir)); |
59 |
|
} catch (IOException e) { |
60 |
0 |
return null; |
61 |
|
} |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
@link |
66 |
|
|
67 |
|
@param@link |
68 |
|
@param@link |
69 |
|
@return@link |
70 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
71 |
0 |
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter filter)... |
72 |
|
{ |
73 |
0 |
try { |
74 |
0 |
return new WrappingDirectoryStream(Files.newDirectoryStream(dir, filter)); |
75 |
|
} catch (IOException e) { |
76 |
0 |
return null; |
77 |
|
} |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
|
@link |
82 |
|
|
83 |
|
@param@link |
84 |
|
@param@link |
85 |
|
@return@link |
86 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
87 |
0 |
public DirectoryStream<Path> newDirectoryStream(Path dir, String glob)... |
88 |
|
{ |
89 |
0 |
try { |
90 |
0 |
return new WrappingDirectoryStream(Files.newDirectoryStream(dir, glob)); |
91 |
|
} catch (IOException e) { |
92 |
0 |
return null; |
93 |
|
} |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
@link |
98 |
|
|
99 |
|
@param@link |
100 |
|
@param@link |
101 |
|
@return@link |
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
3 |
public boolean isDirectory(Path path, LinkOption... options)... |
104 |
|
{ |
105 |
3 |
return Files.isDirectory(path, options); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
@link |
110 |
|
|
111 |
|
@param@link |
112 |
|
@param@link |
113 |
|
@return@link |
114 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
0 |
public boolean isRegularFile(Path path, LinkOption... options)... |
116 |
|
{ |
117 |
0 |
return Files.isRegularFile(path, options); |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
|
@link |
122 |
|
|
123 |
|
@param@link |
124 |
|
@return@link |
125 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
0 |
public boolean isReadable(Path path)... |
127 |
|
{ |
128 |
0 |
return Files.isReadable(path); |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
@link |
133 |
|
|
134 |
|
@param@link |
135 |
|
@return@link |
136 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
137 |
0 |
public boolean isSymbolicLink(Path path)... |
138 |
|
{ |
139 |
0 |
return Files.isSymbolicLink(path); |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
|
@link |
144 |
|
|
145 |
|
@param@link |
146 |
|
@param@link |
147 |
|
@return@link |
148 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
149 |
0 |
public boolean exists(Path path, LinkOption... options)... |
150 |
|
{ |
151 |
0 |
return Files.exists(path, options); |
152 |
|
} |
153 |
|
|
154 |
|
|
155 |
|
@link |
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
@param@link |
163 |
|
@return@link |
164 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
165 |
0 |
public byte[] readAllBytes(Path path)... |
166 |
|
{ |
167 |
0 |
try { |
168 |
0 |
return Files.readAllBytes(path); |
169 |
|
} catch (IOException e) { |
170 |
0 |
return null; |
171 |
|
} |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
|
@link |
176 |
|
|
177 |
|
@param@link |
178 |
|
@param@link |
179 |
|
@return@link |
180 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
181 |
0 |
public List<String> readAllLines(Path path, Charset cs)... |
182 |
|
{ |
183 |
0 |
try { |
184 |
0 |
return Files.readAllLines(path, cs); |
185 |
|
} catch (IOException e) { |
186 |
0 |
return null; |
187 |
|
} |
188 |
|
} |
189 |
|
|
190 |
|
|
191 |
|
@link |
192 |
|
|
193 |
|
@param@link |
194 |
|
@param@link |
195 |
|
@return@link |
196 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
197 |
0 |
public BufferedReader newBufferedReader(Path path, Charset cs)... |
198 |
|
{ |
199 |
0 |
try { |
200 |
0 |
return Files.newBufferedReader(path, cs); |
201 |
|
} catch (IOException e) { |
202 |
0 |
return null; |
203 |
|
} |
204 |
|
} |
205 |
|
|
206 |
|
|
207 |
|
@link |
208 |
|
|
209 |
|
@param@link |
210 |
|
@return@link |
211 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
212 |
0 |
public long size(Path path)... |
213 |
|
{ |
214 |
0 |
try { |
215 |
0 |
return Files.size(path); |
216 |
|
} catch (IOException e) { |
217 |
0 |
return 0L; |
218 |
|
} |
219 |
|
} |
220 |
|
|
221 |
|
|
222 |
|
@link |
223 |
|
|
224 |
|
@param@link |
225 |
|
@param@link |
226 |
|
@param@link |
227 |
|
@return@link |
228 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
229 |
0 |
public Object getAttribute(Path path, String attribute, LinkOption... options)... |
230 |
|
{ |
231 |
0 |
try { |
232 |
0 |
return Files.getAttribute(path, attribute, options); |
233 |
|
} catch (IOException e) { |
234 |
0 |
return null; |
235 |
|
} |
236 |
|
} |
237 |
|
|
238 |
|
|
239 |
|
@link |
240 |
|
|
241 |
|
@param@link |
242 |
|
@param@link |
243 |
|
@param@link |
244 |
|
@return@link |
245 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
246 |
0 |
public Map<String, Object> readAttributes(Path path, String attributes, LinkOption... options)... |
247 |
|
{ |
248 |
0 |
try { |
249 |
0 |
return Files.readAttributes(path, attributes, options); |
250 |
|
} catch (IOException e) { |
251 |
0 |
return null; |
252 |
|
} |
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
|
@link |
257 |
|
|
258 |
|
@param@link |
259 |
|
@param@link |
260 |
|
@return@link |
261 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
262 |
0 |
public FileTime getLastModifiedTime(Path path, LinkOption... options)... |
263 |
|
{ |
264 |
0 |
try { |
265 |
0 |
return Files.getLastModifiedTime(path, options); |
266 |
|
} catch (IOException e) { |
267 |
0 |
return null; |
268 |
|
} |
269 |
|
} |
270 |
|
} |