001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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(String sourceDirName, String destinationDirName);
031    
032            public void copyDirectory(java.io.File source, java.io.File destination);
033    
034            public void copyFile(String source, String destination);
035    
036            public void copyFile(String source, String destination, boolean lazy);
037    
038            public void copyFile(java.io.File source, java.io.File destination);
039    
040            public void copyFile(
041                    java.io.File source, java.io.File destination, boolean lazy);
042    
043            public java.io.File createTempFile();
044    
045            public java.io.File createTempFile(String extension);
046    
047            public String createTempFileName();
048    
049            public String createTempFileName(String extension);
050    
051            public String decodeSafeFileName(String fileName);
052    
053            public boolean delete(String file);
054    
055            public boolean delete(java.io.File file);
056    
057            public void deltree(String directory);
058    
059            public void deltree(java.io.File directory);
060    
061            public String encodeSafeFileName(String fileName);
062    
063            public boolean exists(String fileName);
064    
065            public boolean exists(java.io.File file);
066    
067            public String extractText(InputStream is, String fileName);
068    
069            public String[] find(String directory, String includes, String excludes);
070    
071            public String getAbsolutePath(java.io.File file);
072    
073            public byte[] getBytes(java.io.File file) throws IOException;
074    
075            public byte[] getBytes(InputStream is) throws IOException;
076    
077            public byte[] getBytes(InputStream is, int bufferSize) throws IOException;
078    
079            public String getExtension(String fileName);
080    
081            public String getPath(String fullFileName);
082    
083            public String getShortFileName(String fullFileName);
084    
085            public boolean isAscii(java.io.File file) throws IOException;
086    
087            public boolean isSameContent(java.io.File file, byte[] bytes, int length);
088    
089            public boolean isSameContent(java.io.File file, String s);
090    
091            public String[] listDirs(String fileName);
092    
093            public String[] listDirs(java.io.File file);
094    
095            public String[] listFiles(String fileName);
096    
097            public String[] listFiles(java.io.File file);
098    
099            public void mkdirs(String pathName);
100    
101            public boolean move(String sourceFileName, String destinationFileName);
102    
103            public boolean move(java.io.File source, java.io.File destination);
104    
105            public String read(String fileName) throws IOException;
106    
107            public String read(java.io.File file) throws IOException;
108    
109            public String read(java.io.File file, boolean raw) throws IOException;
110    
111            public String replaceSeparator(String fileName);
112    
113            public java.io.File[] sortFiles(java.io.File[] files);
114    
115            public String stripExtension(String fileName);
116    
117            public List<String> toList(Reader reader);
118    
119            public List<String> toList(String fileName);
120    
121            public Properties toProperties(java.io.FileInputStream fis);
122    
123            public Properties toProperties(String fileName);
124    
125            public void touch(java.io.File file) throws IOException;
126    
127            public void touch(String fileName) throws IOException;
128    
129            public void unzip(java.io.File source, java.io.File destination);
130    
131            public void write(String fileName, String s) throws IOException;
132    
133            public void write(String fileName, String s, boolean lazy)
134                    throws IOException;
135    
136            public void write(String fileName, String s, boolean lazy, boolean append)
137                    throws IOException;
138    
139            public void write(String pathName, String fileName, String s)
140                    throws IOException;
141    
142            public void write(String pathName, String fileName, String s, boolean lazy)
143                    throws IOException;
144    
145            public void write(
146                            String pathName, String fileName, String s, boolean lazy,
147                            boolean append)
148                    throws IOException;
149    
150            public void write(java.io.File file, String s) throws IOException;
151    
152            public void write(java.io.File file, String s, boolean lazy)
153                    throws IOException;
154    
155            public void write(java.io.File file, String s, boolean lazy, boolean append)
156                    throws IOException;
157    
158            public void write(String fileName, byte[] bytes) throws IOException;
159    
160            public void write(java.io.File file, byte[] bytes) throws IOException;
161    
162            public void write(java.io.File file, byte[] bytes, int offset, int length)
163                    throws IOException;
164    
165            public void write(String fileName, InputStream is) throws IOException;
166    
167            public void write(java.io.File file, InputStream is) throws IOException;
168    
169    }