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