001    /**
002     * Copyright (c) 2000-2013 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 void copyDirectory(java.io.File source, java.io.File destination)
031                    throws IOException;
032    
033            public void copyDirectory(String sourceDirName, String destinationDirName)
034                    throws IOException;
035    
036            public void copyFile(java.io.File source, java.io.File destination)
037                    throws IOException;
038    
039            public void copyFile(
040                            java.io.File source, java.io.File destination, boolean lazy)
041                    throws IOException;
042    
043            public void copyFile(String source, String destination) throws IOException;
044    
045            public void copyFile(String source, String destination, boolean lazy)
046                    throws IOException;
047    
048            public java.io.File createTempFile();
049    
050            public java.io.File createTempFile(byte[] bytes) throws IOException;
051    
052            public java.io.File createTempFile(InputStream is) throws IOException;
053    
054            public java.io.File createTempFile(String extension);
055    
056            public java.io.File createTempFile(String prefix, String extension);
057    
058            public String createTempFileName();
059    
060            public String createTempFileName(String extension);
061    
062            public String createTempFileName(String prefix, String extension);
063    
064            public java.io.File createTempFolder();
065    
066            public String decodeSafeFileName(String fileName);
067    
068            public boolean delete(java.io.File file);
069    
070            public boolean delete(String file);
071    
072            public void deltree(java.io.File directory);
073    
074            public void deltree(String directory);
075    
076            public String encodeSafeFileName(String fileName);
077    
078            public boolean exists(java.io.File file);
079    
080            public boolean exists(String fileName);
081    
082            public String extractText(InputStream is, String fileName);
083    
084            public String[] find(String directory, String includes, String excludes);
085    
086            public String getAbsolutePath(java.io.File file);
087    
088            public byte[] getBytes(InputStream is) throws IOException;
089    
090            public byte[] getBytes(InputStream is, int bufferSize) throws IOException;
091    
092            public byte[] getBytes(
093                            InputStream inputStream, int bufferSize, boolean cleanUpStream)
094                    throws IOException;
095    
096            public byte[] getBytes(java.io.File file) throws IOException;
097    
098            public String getExtension(String fileName);
099    
100            public String getMD5Checksum(java.io.File file) throws IOException;
101    
102            public String getPath(String fullFileName);
103    
104            public String getShortFileName(String fullFileName);
105    
106            public boolean isAscii(java.io.File file) throws IOException;
107    
108            public boolean isSameContent(java.io.File file, byte[] bytes, int length);
109    
110            public boolean isSameContent(java.io.File file, String s);
111    
112            public String[] listDirs(java.io.File file);
113    
114            public String[] listDirs(String fileName);
115    
116            public String[] listFiles(java.io.File file);
117    
118            public String[] listFiles(String fileName);
119    
120            public void mkdirs(String pathName);
121    
122            public boolean move(java.io.File source, java.io.File destination);
123    
124            public boolean move(String sourceFileName, String destinationFileName);
125    
126            public String read(java.io.File file) throws IOException;
127    
128            public String read(java.io.File file, boolean raw) throws IOException;
129    
130            public String read(String fileName) throws IOException;
131    
132            public String replaceSeparator(String fileName);
133    
134            public java.io.File[] sortFiles(java.io.File[] files);
135    
136            public String stripExtension(String fileName);
137    
138            public List<String> toList(Reader reader);
139    
140            public List<String> toList(String fileName);
141    
142            public Properties toProperties(java.io.FileInputStream fis);
143    
144            public Properties toProperties(String fileName);
145    
146            public void touch(java.io.File file) throws IOException;
147    
148            public void touch(String fileName) throws IOException;
149    
150            public void unzip(java.io.File source, java.io.File destination);
151    
152            public void write(java.io.File file, byte[] bytes) throws IOException;
153    
154            public void write(java.io.File file, byte[] bytes, boolean append)
155                    throws IOException;
156    
157            public void write(java.io.File file, byte[] bytes, int offset, int length)
158                    throws IOException;
159    
160            public void write(
161                            java.io.File file, byte[] bytes, int offset, int length,
162                            boolean append)
163                    throws IOException;
164    
165            public void write(java.io.File file, InputStream is) throws IOException;
166    
167            public void write(java.io.File file, String s) throws IOException;
168    
169            public void write(java.io.File file, String s, boolean lazy)
170                    throws IOException;
171    
172            public void write(java.io.File file, String s, boolean lazy, boolean append)
173                    throws IOException;
174    
175            public void write(String fileName, byte[] bytes) throws IOException;
176    
177            public void write(String fileName, InputStream is) throws IOException;
178    
179            public void write(String fileName, String s) throws IOException;
180    
181            public void write(String fileName, String s, boolean lazy)
182                    throws IOException;
183    
184            public void write(String fileName, String s, boolean lazy, boolean append)
185                    throws IOException;
186    
187            public void write(String pathName, String fileName, String s)
188                    throws IOException;
189    
190            public void write(String pathName, String fileName, String s, boolean lazy)
191                    throws IOException;
192    
193            public void write(
194                            String pathName, String fileName, String s, boolean lazy,
195                            boolean append)
196                    throws IOException;
197    
198    }