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