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 String createTempFileName();
057    
058            public String createTempFileName(String extension);
059    
060            public java.io.File createTempFolder();
061    
062            public String decodeSafeFileName(String fileName);
063    
064            public boolean delete(java.io.File file);
065    
066            public boolean delete(String file);
067    
068            public void deltree(java.io.File directory);
069    
070            public void deltree(String directory);
071    
072            public String encodeSafeFileName(String fileName);
073    
074            public boolean exists(java.io.File file);
075    
076            public boolean exists(String fileName);
077    
078            public String extractText(InputStream is, String fileName);
079    
080            public String[] find(String directory, String includes, String excludes);
081    
082            public String getAbsolutePath(java.io.File file);
083    
084            public byte[] getBytes(InputStream is) throws IOException;
085    
086            public byte[] getBytes(InputStream is, int bufferSize) throws IOException;
087    
088            public byte[] getBytes(
089                            InputStream inputStream, int bufferSize, boolean cleanUpStream)
090                    throws IOException;
091    
092            public byte[] getBytes(java.io.File file) throws IOException;
093    
094            public String getExtension(String fileName);
095    
096            public String getPath(String fullFileName);
097    
098            public String getShortFileName(String fullFileName);
099    
100            public boolean isAscii(java.io.File file) throws IOException;
101    
102            public boolean isSameContent(java.io.File file, byte[] bytes, int length);
103    
104            public boolean isSameContent(java.io.File file, String s);
105    
106            public String[] listDirs(java.io.File file);
107    
108            public String[] listDirs(String fileName);
109    
110            public String[] listFiles(java.io.File file);
111    
112            public String[] listFiles(String fileName);
113    
114            public void mkdirs(String pathName);
115    
116            public boolean move(java.io.File source, java.io.File destination);
117    
118            public boolean move(String sourceFileName, String destinationFileName);
119    
120            public String read(java.io.File file) throws IOException;
121    
122            public String read(java.io.File file, boolean raw) throws IOException;
123    
124            public String read(String fileName) throws IOException;
125    
126            public String replaceSeparator(String fileName);
127    
128            public java.io.File[] sortFiles(java.io.File[] files);
129    
130            public String stripExtension(String fileName);
131    
132            public List<String> toList(Reader reader);
133    
134            public List<String> toList(String fileName);
135    
136            public Properties toProperties(java.io.FileInputStream fis);
137    
138            public Properties toProperties(String fileName);
139    
140            public void touch(java.io.File file) throws IOException;
141    
142            public void touch(String fileName) throws IOException;
143    
144            public void unzip(java.io.File source, java.io.File destination);
145    
146            public void write(java.io.File file, byte[] bytes) throws IOException;
147    
148            public void write(java.io.File file, byte[] bytes, int offset, int length)
149                    throws IOException;
150    
151            public void write(java.io.File file, InputStream is) throws IOException;
152    
153            public void write(java.io.File file, String s) throws IOException;
154    
155            public void write(java.io.File file, String s, boolean lazy)
156                    throws IOException;
157    
158            public void write(java.io.File file, String s, boolean lazy, boolean append)
159                    throws IOException;
160    
161            public void write(String fileName, byte[] bytes) throws IOException;
162    
163            public void write(String fileName, InputStream is) throws IOException;
164    
165            public void write(String fileName, String s) throws IOException;
166    
167            public void write(String fileName, String s, boolean lazy)
168                    throws IOException;
169    
170            public void write(String fileName, String s, boolean lazy, boolean append)
171                    throws IOException;
172    
173            public void write(String pathName, String fileName, String s)
174                    throws IOException;
175    
176            public void write(String pathName, String fileName, String s, boolean lazy)
177                    throws IOException;
178    
179            public void write(
180                            String pathName, String fileName, String s, boolean lazy,
181                            boolean append)
182                    throws IOException;
183    
184    }