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