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