1
19
20 package com.liferay.portal.kernel.util;
21
22 import java.io.File;
23 import java.io.FileInputStream;
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.io.Reader;
27
28 import java.util.List;
29 import java.util.Properties;
30
31
38 public class FileUtil {
39
40 public static void copyDirectory(
41 String sourceDirName, String destinationDirName) {
42
43 getFile().copyDirectory(sourceDirName, destinationDirName);
44 }
45
46 public static void copyDirectory(File source, File destination) {
47 getFile().copyDirectory(source, destination);
48 }
49
50 public static void copyFile(String source, String destination) {
51 getFile().copyFile(source, destination);
52 }
53
54 public static void copyFile(
55 String source, String destination, boolean lazy) {
56
57 getFile().copyFile(source, destination, lazy);
58 }
59
60 public static void copyFile(File source, File destination) {
61 getFile().copyFile(source, destination);
62 }
63
64 public static void copyFile(File source, File destination, boolean lazy) {
65 getFile().copyFile(source, destination, lazy);
66 }
67
68 public static File createTempFile() {
69 return getFile().createTempFile();
70 }
71
72 public static File createTempFile(String extension) {
73 return getFile().createTempFile(extension);
74 }
75
76 public static String createTempFileName() {
77 return getFile().createTempFileName();
78 }
79
80 public static String createTempFileName(String extension) {
81 return getFile().createTempFileName(extension);
82 }
83
84 public static boolean delete(String file) {
85 return getFile().delete(file);
86 }
87
88 public static boolean delete(File file) {
89 return getFile().delete(file);
90 }
91
92 public static void deltree(String directory) {
93 getFile().deltree(directory);
94 }
95
96 public static void deltree(File directory) {
97 getFile().deltree(directory);
98 }
99
100 public static boolean exists(String fileName) {
101 return getFile().exists(fileName);
102 }
103
104 public static boolean exists(File file) {
105 return getFile().exists(file);
106 }
107
108 public static String extractText(InputStream is, String fileExt) {
109 return getFile().extractText(is, fileExt);
110 }
111
112 public static String getAbsolutePath(File file) {
113 return getFile().getAbsolutePath(file);
114 }
115
116 public static byte[] getBytes(File file) throws IOException {
117 return getFile().getBytes(file);
118 }
119
120 public static byte[] getBytes(InputStream is) throws IOException {
121 return getFile().getBytes(is);
122 }
123
124 public static byte[] getBytes(InputStream is, int bufferSize)
125 throws IOException {
126
127 return getFile().getBytes(is);
128 }
129
130 public static String getExtension(String fileName) {
131 return getFile().getExtension(fileName);
132 }
133
134 public static com.liferay.portal.kernel.util.File getFile() {
135 return _file;
136 }
137
138 public static String getPath(String fullFileName) {
139 return getFile().getPath(fullFileName);
140 }
141
142 public static String getShortFileName(String fullFileName) {
143 return getFile().getShortFileName(fullFileName);
144 }
145
146 public static boolean isAscii(File file) throws IOException {
147 return getFile().isAscii(file);
148 }
149
150 public static String[] listDirs(String fileName) {
151 return getFile().listDirs(fileName);
152 }
153
154 public static String[] listDirs(File file) {
155 return getFile().listDirs(file);
156 }
157
158 public static String[] listFiles(String fileName) {
159 return getFile().listFiles(fileName);
160 }
161
162 public static String[] listFiles(File file) {
163 return getFile().listFiles(file);
164 }
165
166 public static void mkdirs(String pathName) {
167 getFile().mkdirs(pathName);
168 }
169
170 public static boolean move(
171 String sourceFileName, String destinationFileName) {
172
173 return getFile().move(sourceFileName, destinationFileName);
174 }
175
176 public static boolean move(File source, File destination) {
177 return getFile().move(source, destination);
178 }
179
180 public static String read(String fileName) throws IOException {
181 return getFile().read(fileName);
182 }
183
184 public static String read(File file) throws IOException {
185 return getFile().read(file);
186 }
187
188 public static String read(File file, boolean raw) throws IOException {
189 return getFile().read(file, raw);
190 }
191
192 public static String replaceSeparator(String fileName) {
193 return getFile().replaceSeparator(fileName);
194 }
195
196 public static File[] sortFiles(File[] files) {
197 return getFile().sortFiles(files);
198 }
199
200 public static String stripExtension(String fileName) {
201 return getFile().stripExtension(fileName);
202 }
203
204 public static List<String> toList(Reader reader) {
205 return getFile().toList(reader);
206 }
207
208 public static List<String> toList(String fileName) {
209 return getFile().toList(fileName);
210 }
211
212 public static Properties toProperties(FileInputStream fis) {
213 return getFile().toProperties(fis);
214 }
215
216 public static Properties toProperties(String fileName) {
217 return getFile().toProperties(fileName);
218 }
219
220 public static void write(String fileName, String s) throws IOException {
221 getFile().write(fileName, s);
222 }
223
224 public static void write(String fileName, String s, boolean lazy)
225 throws IOException {
226
227 getFile().write(fileName, s, lazy);
228 }
229
230 public static void write(
231 String fileName, String s, boolean lazy, boolean append)
232 throws IOException {
233
234 getFile().write(fileName, s, lazy, append);
235 }
236
237 public static void write(String pathName, String fileName, String s)
238 throws IOException {
239
240 getFile().write(pathName, fileName, s);
241 }
242
243 public static void write(
244 String pathName, String fileName, String s, boolean lazy)
245 throws IOException {
246
247 getFile().write(pathName, fileName, s, lazy);
248 }
249
250 public static void write(
251 String pathName, String fileName, String s, boolean lazy,
252 boolean append)
253 throws IOException {
254
255 getFile().write(pathName, fileName, s, lazy, append);
256 }
257
258 public static void write(File file, String s) throws IOException {
259 getFile().write(file, s);
260 }
261
262 public static void write(File file, String s, boolean lazy)
263 throws IOException {
264
265 getFile().write(file, s, lazy);
266 }
267
268 public static void write(File file, String s, boolean lazy, boolean append)
269 throws IOException {
270
271 getFile().write(file, s, lazy, append);
272 }
273
274 public static void write(String fileName, byte[] bytes) throws IOException {
275 getFile().write(fileName, bytes);
276 }
277
278 public static void write(File file, byte[] bytes) throws IOException {
279 getFile().write(file, bytes);
280 }
281
282 public static void write(String fileName, InputStream is)
283 throws IOException {
284
285 getFile().write(fileName, is);
286 }
287
288 public static void write(File file, InputStream is) throws IOException {
289 getFile().write(file, is);
290 }
291
292 public void setFile(com.liferay.portal.kernel.util.File file) {
293 _file = file;
294 }
295
296 private static com.liferay.portal.kernel.util.File _file;
297
298 }