001    /**
002     * Copyright (c) 2000-2010 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 String[] listDirs(String fileName);
088    
089            public String[] listDirs(java.io.File file);
090    
091            public String[] listFiles(String fileName);
092    
093            public String[] listFiles(java.io.File file);
094    
095            public void mkdirs(String pathName);
096    
097            public boolean move(String sourceFileName, String destinationFileName);
098    
099            public boolean move(java.io.File source, java.io.File destination);
100    
101            public String read(String fileName) throws IOException;
102    
103            public String read(java.io.File file) throws IOException;
104    
105            public String read(java.io.File file, boolean raw) throws IOException;
106    
107            public String replaceSeparator(String fileName);
108    
109            public java.io.File[] sortFiles(java.io.File[] files);
110    
111            public String stripExtension(String fileName);
112    
113            public List<String> toList(Reader reader);
114    
115            public List<String> toList(String fileName);
116    
117            public Properties toProperties(java.io.FileInputStream fis);
118    
119            public Properties toProperties(String fileName);
120    
121            public void write(String fileName, String s) throws IOException;
122    
123            public void write(String fileName, String s, boolean lazy)
124                    throws IOException;
125    
126            public void write(String fileName, String s, boolean lazy, boolean append)
127                    throws IOException;
128    
129            public void write(String pathName, String fileName, String s)
130                    throws IOException;
131    
132            public void write(String pathName, String fileName, String s, boolean lazy)
133                    throws IOException;
134    
135            public void write(
136                            String pathName, String fileName, String s, boolean lazy,
137                            boolean append)
138                    throws IOException;
139    
140            public void write(java.io.File file, String s) throws IOException;
141    
142            public void write(java.io.File file, String s, boolean lazy)
143                    throws IOException;
144    
145            public void write(java.io.File file, String s, boolean lazy, boolean append)
146                    throws IOException;
147    
148            public void write(String fileName, byte[] bytes) throws IOException;
149    
150            public void write(java.io.File file, byte[] bytes) throws IOException;
151    
152            public void write(java.io.File file, byte[] bytes, int offset, int length)
153                    throws IOException;
154    
155            public void write(String fileName, InputStream is) throws IOException;
156    
157            public void write(java.io.File file, InputStream is) throws IOException;
158    
159    }