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 boolean delete(String file) {
80 return getFile().delete(file);
81 }
82
83 public static boolean delete(File file) {
84 return getFile().delete(file);
85 }
86
87 public static void deltree(String directory) {
88 getFile().deltree(directory);
89 }
90
91 public static void deltree(File directory) {
92 getFile().deltree(directory);
93 }
94
95 public static boolean exists(String fileName) {
96 return getFile().exists(fileName);
97 }
98
99 public static boolean exists(File file) {
100 return getFile().exists(file);
101 }
102
103 public static String extractText(InputStream is, String fileExt) {
104 return getFile().extractText(is, fileExt);
105 }
106
107 public static String getAbsolutePath(File file) {
108 return getFile().getAbsolutePath(file);
109 }
110
111 public static byte[] getBytes(File file) throws IOException {
112 return getFile().getBytes(file);
113 }
114
115 public static byte[] getBytes(InputStream is) throws IOException {
116 return getFile().getBytes(is);
117 }
118
119 public static byte[] getBytes(InputStream is, int bufferSize)
120 throws IOException {
121
122 return getFile().getBytes(is);
123 }
124
125 public static String getExtension(String fileName) {
126 return getFile().getExtension(fileName);
127 }
128
129 public static com.liferay.portal.kernel.util.File getFile() {
130 return _file;
131 }
132
133 public static String getPath(String fullFileName) {
134 return getFile().getPath(fullFileName);
135 }
136
137 public static String getShortFileName(String fullFileName) {
138 return getFile().getShortFileName(fullFileName);
139 }
140
141 public static boolean isAscii(File file) throws IOException {
142 return getFile().isAscii(file);
143 }
144
145 public static String[] listDirs(String fileName) {
146 return getFile().listDirs(fileName);
147 }
148
149 public static String[] listDirs(File file) {
150 return getFile().listDirs(file);
151 }
152
153 public static String[] listFiles(String fileName) {
154 return getFile().listFiles(fileName);
155 }
156
157 public static String[] listFiles(File file) {
158 return getFile().listFiles(file);
159 }
160
161 public static void mkdirs(String pathName) {
162 getFile().mkdirs(pathName);
163 }
164
165 public static boolean move(
166 String sourceFileName, String destinationFileName) {
167
168 return getFile().move(sourceFileName, destinationFileName);
169 }
170
171 public static boolean move(File source, File destination) {
172 return getFile().move(source, destination);
173 }
174
175 public static String read(String fileName) throws IOException {
176 return getFile().read(fileName);
177 }
178
179 public static String read(File file) throws IOException {
180 return getFile().read(file);
181 }
182
183 public static String read(File file, boolean raw) throws IOException {
184 return getFile().read(file, raw);
185 }
186
187 public static String replaceSeparator(String fileName) {
188 return getFile().replaceSeparator(fileName);
189 }
190
191 public static File[] sortFiles(File[] files) {
192 return getFile().sortFiles(files);
193 }
194
195 public static String stripExtension(String fileName) {
196 return getFile().stripExtension(fileName);
197 }
198
199 public static List<String> toList(Reader reader) {
200 return getFile().toList(reader);
201 }
202
203 public static List<String> toList(String fileName) {
204 return getFile().toList(fileName);
205 }
206
207 public static Properties toProperties(FileInputStream fis) {
208 return getFile().toProperties(fis);
209 }
210
211 public static Properties toProperties(String fileName) {
212 return getFile().toProperties(fileName);
213 }
214
215 public static void write(String fileName, String s) throws IOException {
216 getFile().write(fileName, s);
217 }
218
219 public static void write(String fileName, String s, boolean lazy)
220 throws IOException {
221
222 getFile().write(fileName, s, lazy);
223 }
224
225 public static void write(
226 String fileName, String s, boolean lazy, boolean append)
227 throws IOException {
228
229 getFile().write(fileName, s, lazy, append);
230 }
231
232 public static void write(String pathName, String fileName, String s)
233 throws IOException {
234
235 getFile().write(pathName, fileName, s);
236 }
237
238 public static void write(
239 String pathName, String fileName, String s, boolean lazy)
240 throws IOException {
241
242 getFile().write(pathName, fileName, s, lazy);
243 }
244
245 public static void write(
246 String pathName, String fileName, String s, boolean lazy,
247 boolean append)
248 throws IOException {
249
250 getFile().write(pathName, fileName, s, lazy, append);
251 }
252
253 public static void write(File file, String s) throws IOException {
254 getFile().write(file, s);
255 }
256
257 public static void write(File file, String s, boolean lazy)
258 throws IOException {
259
260 getFile().write(file, s, lazy);
261 }
262
263 public static void write(File file, String s, boolean lazy, boolean append)
264 throws IOException {
265
266 getFile().write(file, s, lazy, append);
267 }
268
269 public static void write(String fileName, byte[] bytes) throws IOException {
270 getFile().write(fileName, bytes);
271 }
272
273 public static void write(File file, byte[] bytes) throws IOException {
274 getFile().write(file, bytes);
275 }
276
277 public static void write(String fileName, InputStream is)
278 throws IOException {
279
280 getFile().write(fileName, is);
281 }
282
283 public static void write(File file, InputStream is) throws IOException {
284 getFile().write(file, is);
285 }
286
287 public void setFile(com.liferay.portal.kernel.util.File file) {
288 _file = file;
289 }
290
291 private static com.liferay.portal.kernel.util.File _file;
292
293 }