001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.util;
016    
017    import java.io.IOException;
018    import java.io.InputStream;
019    import java.io.Reader;
020    
021    import java.util.List;
022    import java.util.Properties;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     * @author Alexander Chow
027     */
028    public interface File {
029    
030            public String appendParentheticalSuffix(String fileName, String suffix);
031    
032            public String appendSuffix(String fileName, String suffix);
033    
034            public void copyDirectory(java.io.File source, java.io.File destination)
035                    throws IOException;
036    
037            public void copyDirectory(String sourceDirName, String destinationDirName)
038                    throws IOException;
039    
040            public void copyFile(java.io.File source, java.io.File destination)
041                    throws IOException;
042    
043            public void copyFile(
044                            java.io.File source, java.io.File destination, boolean lazy)
045                    throws IOException;
046    
047            public void copyFile(String source, String destination) throws IOException;
048    
049            public void copyFile(String source, String destination, boolean lazy)
050                    throws IOException;
051    
052            public java.io.File createTempFile();
053    
054            public java.io.File createTempFile(byte[] bytes) throws IOException;
055    
056            public java.io.File createTempFile(InputStream is) throws IOException;
057    
058            public java.io.File createTempFile(String extension);
059    
060            public java.io.File createTempFile(String prefix, String extension);
061    
062            public String createTempFileName();
063    
064            public String createTempFileName(String extension);
065    
066            public String createTempFileName(String prefix, String extension);
067    
068            public java.io.File createTempFolder() throws IOException;
069    
070            public String decodeSafeFileName(String fileName);
071    
072            public boolean delete(java.io.File file);
073    
074            public boolean delete(String file);
075    
076            public void deltree(java.io.File directory);
077    
078            public void deltree(String directory);
079    
080            public String encodeSafeFileName(String fileName);
081    
082            public boolean exists(java.io.File file);
083    
084            public boolean exists(String fileName);
085    
086            public String extractText(InputStream is, String fileName);
087    
088            public String extractText(
089                    InputStream is, String fileName, int maxStringLength);
090    
091            public String[] find(String directory, String includes, String excludes);
092    
093            public String getAbsolutePath(java.io.File file);
094    
095            public byte[] getBytes(Class<?> clazz, String fileName) throws IOException;
096    
097            public byte[] getBytes(InputStream is) throws IOException;
098    
099            public byte[] getBytes(InputStream is, int bufferSize) throws IOException;
100    
101            public byte[] getBytes(
102                            InputStream inputStream, int bufferSize, boolean cleanUpStream)
103                    throws IOException;
104    
105            public byte[] getBytes(java.io.File file) throws IOException;
106    
107            public String getExtension(String fileName);
108    
109            public String getMD5Checksum(java.io.File file) throws IOException;
110    
111            public String getPath(String fullFileName);
112    
113            public String getShortFileName(String fullFileName);
114    
115            public boolean isAscii(java.io.File file) throws IOException;
116    
117            public boolean isSameContent(java.io.File file, byte[] bytes, int length);
118    
119            public boolean isSameContent(java.io.File file, String s);
120    
121            public String[] listDirs(java.io.File file);
122    
123            public String[] listDirs(String fileName);
124    
125            public String[] listFiles(java.io.File file);
126    
127            public String[] listFiles(String fileName);
128    
129            public void mkdirs(java.io.File file) throws IOException;
130    
131            public void mkdirs(String pathName);
132    
133            public boolean move(java.io.File source, java.io.File destination);
134    
135            public boolean move(String sourceFileName, String destinationFileName);
136    
137            public String read(java.io.File file) throws IOException;
138    
139            public String read(java.io.File file, boolean raw) throws IOException;
140    
141            public String read(String fileName) throws IOException;
142    
143            public String replaceSeparator(String fileName);
144    
145            public java.io.File[] sortFiles(java.io.File[] files);
146    
147            public String stripExtension(String fileName);
148    
149            public String stripParentheticalSuffix(String fileName);
150    
151            public List<String> toList(Reader reader);
152    
153            public List<String> toList(String fileName);
154    
155            public Properties toProperties(java.io.FileInputStream fis);
156    
157            public Properties toProperties(String fileName);
158    
159            public void touch(java.io.File file) throws IOException;
160    
161            public void touch(String fileName) throws IOException;
162    
163            public void unzip(java.io.File source, java.io.File destination);
164    
165            public void write(java.io.File file, byte[] bytes) throws IOException;
166    
167            public void write(java.io.File file, byte[] bytes, boolean append)
168                    throws IOException;
169    
170            public void write(java.io.File file, byte[] bytes, int offset, int length)
171                    throws IOException;
172    
173            public void write(
174                            java.io.File file, byte[] bytes, int offset, int length,
175                            boolean append)
176                    throws IOException;
177    
178            public void write(java.io.File file, InputStream is) throws IOException;
179    
180            public void write(java.io.File file, String s) throws IOException;
181    
182            public void write(java.io.File file, String s, boolean lazy)
183                    throws IOException;
184    
185            public void write(java.io.File file, String s, boolean lazy, boolean append)
186                    throws IOException;
187    
188            public void write(String fileName, byte[] bytes) throws IOException;
189    
190            public void write(String fileName, InputStream is) throws IOException;
191    
192            public void write(String fileName, String s) throws IOException;
193    
194            public void write(String fileName, String s, boolean lazy)
195                    throws IOException;
196    
197            public void write(String fileName, String s, boolean lazy, boolean append)
198                    throws IOException;
199    
200            public void write(String pathName, String fileName, String s)
201                    throws IOException;
202    
203            public void write(String pathName, String fileName, String s, boolean lazy)
204                    throws IOException;
205    
206            public void write(
207                            String pathName, String fileName, String s, boolean lazy,
208                            boolean append)
209                    throws IOException;
210    
211    }