001
014
015 package com.liferay.portal.kernel.util;
016
017 import java.io.File;
018 import java.io.FileInputStream;
019 import java.io.IOException;
020 import java.io.InputStream;
021 import java.io.Reader;
022
023 import java.util.List;
024 import java.util.Properties;
025
026
030 public class FileUtil {
031
032 public static void copyDirectory(
033 String sourceDirName, String destinationDirName) {
034
035 getFile().copyDirectory(sourceDirName, destinationDirName);
036 }
037
038 public static void copyDirectory(File source, File destination) {
039 getFile().copyDirectory(source, destination);
040 }
041
042 public static void copyFile(String source, String destination) {
043 getFile().copyFile(source, destination);
044 }
045
046 public static void copyFile(
047 String source, String destination, boolean lazy) {
048
049 getFile().copyFile(source, destination, lazy);
050 }
051
052 public static void copyFile(File source, File destination) {
053 getFile().copyFile(source, destination);
054 }
055
056 public static void copyFile(File source, File destination, boolean lazy) {
057 getFile().copyFile(source, destination, lazy);
058 }
059
060 public static File createTempFile() {
061 return getFile().createTempFile();
062 }
063
064 public static File createTempFile(String extension) {
065 return getFile().createTempFile(extension);
066 }
067
068 public static String createTempFileName() {
069 return getFile().createTempFileName();
070 }
071
072 public static String createTempFileName(String extension) {
073 return getFile().createTempFileName(extension);
074 }
075
076 public static String decodeSafeFileName(String fileName) {
077 return getFile().decodeSafeFileName(fileName);
078 }
079
080 public static boolean delete(String file) {
081 return getFile().delete(file);
082 }
083
084 public static boolean delete(File file) {
085 return getFile().delete(file);
086 }
087
088 public static void deltree(String directory) {
089 getFile().deltree(directory);
090 }
091
092 public static void deltree(File directory) {
093 getFile().deltree(directory);
094 }
095
096 public static String encodeSafeFileName(String fileName) {
097 return getFile().encodeSafeFileName(fileName);
098 }
099
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
117 public static String extractText(InputStream is, String fileName) {
118 return getFile().extractText(is, fileName);
119 }
120
121 public static String[] find(
122 String directory, String includes, String excludes) {
123
124 return getFile().find(directory, includes, excludes);
125 }
126
127 public static String getAbsolutePath(File file) {
128 return getFile().getAbsolutePath(file);
129 }
130
131 public static byte[] getBytes(File file) throws IOException {
132 return getFile().getBytes(file);
133 }
134
135 public static byte[] getBytes(InputStream is) throws IOException {
136 return getFile().getBytes(is);
137 }
138
139 public static byte[] getBytes(InputStream is, int bufferSize)
140 throws IOException {
141
142 return getFile().getBytes(is);
143 }
144
145 public static String getExtension(String fileName) {
146 return getFile().getExtension(fileName);
147 }
148
149 public static com.liferay.portal.kernel.util.File getFile() {
150 return _file;
151 }
152
153 public static String getPath(String fullFileName) {
154 return getFile().getPath(fullFileName);
155 }
156
157 public static String getShortFileName(String fullFileName) {
158 return getFile().getShortFileName(fullFileName);
159 }
160
161 public static boolean isAscii(File file) throws IOException {
162 return getFile().isAscii(file);
163 }
164
165 public static String[] listDirs(String fileName) {
166 return getFile().listDirs(fileName);
167 }
168
169 public static String[] listDirs(File file) {
170 return getFile().listDirs(file);
171 }
172
173 public static String[] listFiles(String fileName) {
174 return getFile().listFiles(fileName);
175 }
176
177 public static String[] listFiles(File file) {
178 return getFile().listFiles(file);
179 }
180
181 public static void mkdirs(String pathName) {
182 getFile().mkdirs(pathName);
183 }
184
185 public static boolean move(
186 String sourceFileName, String destinationFileName) {
187
188 return getFile().move(sourceFileName, destinationFileName);
189 }
190
191 public static boolean move(File source, File destination) {
192 return getFile().move(source, destination);
193 }
194
195 public static String read(String fileName) throws IOException {
196 return getFile().read(fileName);
197 }
198
199 public static String read(File file) throws IOException {
200 return getFile().read(file);
201 }
202
203 public static String read(File file, boolean raw) throws IOException {
204 return getFile().read(file, raw);
205 }
206
207 public static String replaceSeparator(String fileName) {
208 return getFile().replaceSeparator(fileName);
209 }
210
211 public static File[] sortFiles(File[] files) {
212 return getFile().sortFiles(files);
213 }
214
215 public static String stripExtension(String fileName) {
216 return getFile().stripExtension(fileName);
217 }
218
219 public static List<String> toList(Reader reader) {
220 return getFile().toList(reader);
221 }
222
223 public static List<String> toList(String fileName) {
224 return getFile().toList(fileName);
225 }
226
227 public static Properties toProperties(FileInputStream fis) {
228 return getFile().toProperties(fis);
229 }
230
231 public static Properties toProperties(String fileName) {
232 return getFile().toProperties(fileName);
233 }
234
235 public static void write(String fileName, String s) throws IOException {
236 getFile().write(fileName, s);
237 }
238
239 public static void write(String fileName, String s, boolean lazy)
240 throws IOException {
241
242 getFile().write(fileName, s, lazy);
243 }
244
245 public static void write(
246 String fileName, String s, boolean lazy, boolean append)
247 throws IOException {
248
249 getFile().write(fileName, s, lazy, append);
250 }
251
252 public static void write(String pathName, String fileName, String s)
253 throws IOException {
254
255 getFile().write(pathName, fileName, s);
256 }
257
258 public static void write(
259 String pathName, String fileName, String s, boolean lazy)
260 throws IOException {
261
262 getFile().write(pathName, fileName, s, lazy);
263 }
264
265 public static void write(
266 String pathName, String fileName, String s, boolean lazy,
267 boolean append)
268 throws IOException {
269
270 getFile().write(pathName, fileName, s, lazy, append);
271 }
272
273 public static void write(File file, String s) throws IOException {
274 getFile().write(file, s);
275 }
276
277 public static void write(File file, String s, boolean lazy)
278 throws IOException {
279
280 getFile().write(file, s, lazy);
281 }
282
283 public static void write(File file, String s, boolean lazy, boolean append)
284 throws IOException {
285
286 getFile().write(file, s, lazy, append);
287 }
288
289 public static void write(String fileName, byte[] bytes) throws IOException {
290 getFile().write(fileName, bytes);
291 }
292
293 public static void write(File file, byte[] bytes) throws IOException {
294 getFile().write(file, bytes);
295 }
296
297 public static void write(File file, byte[] bytes, int offset, int length)
298 throws IOException {
299
300 getFile().write(file, bytes, offset, length);
301 }
302
303 public static void write(String fileName, InputStream is)
304 throws IOException {
305
306 getFile().write(fileName, is);
307 }
308
309 public static void write(File file, InputStream is) throws IOException {
310 getFile().write(file, is);
311 }
312
313 public void setFile(com.liferay.portal.kernel.util.File file) {
314 _file = file;
315 }
316
317 private static com.liferay.portal.kernel.util.File _file;
318
319 }