1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.kernel.util;
21  
22  import java.io.IOException;
23  import java.io.InputStream;
24  import java.io.Reader;
25  
26  import java.util.List;
27  import java.util.Properties;
28  
29  /**
30   * <a href="File.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   * @author Alexander Chow
34   *
35   */
36  public interface File {
37  
38      public void copyDirectory(String sourceDirName, String destinationDirName);
39  
40      public void copyDirectory(java.io.File source, java.io.File destination);
41  
42      public void copyFile(String source, String destination);
43  
44      public void copyFile(String source, String destination, boolean lazy);
45  
46      public void copyFile(java.io.File source, java.io.File destination);
47  
48      public void copyFile(
49          java.io.File source, java.io.File destination, boolean lazy);
50  
51      public java.io.File createTempFile();
52  
53      public java.io.File createTempFile(String extension);
54  
55      public boolean delete(String file);
56  
57      public boolean delete(java.io.File file);
58  
59      public void deltree(String directory);
60  
61      public void deltree(java.io.File directory);
62  
63      public boolean exists(String fileName);
64  
65      public boolean exists(java.io.File file);
66  
67      public String extractText(InputStream is, String fileExt);
68  
69      public String getAbsolutePath(java.io.File file);
70  
71      public byte[] getBytes(java.io.File file) throws IOException;
72  
73      public byte[] getBytes(InputStream is) throws IOException;
74  
75      public byte[] getBytes(InputStream is, int bufferSize) throws IOException;
76  
77      public String getExtension(String fileName);
78  
79      public String getPath(String fullFileName);
80  
81      public String getShortFileName(String fullFileName);
82  
83      public boolean isAscii(java.io.File file) throws IOException;
84  
85      public String[] listDirs(String fileName);
86  
87      public String[] listDirs(java.io.File file);
88  
89      public String[] listFiles(String fileName);
90  
91      public String[] listFiles(java.io.File file);
92  
93      public void mkdirs(String pathName);
94  
95      public boolean move(String sourceFileName, String destinationFileName);
96  
97      public boolean move(java.io.File source, java.io.File destination);
98  
99      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(String fileName, InputStream is) throws IOException;
151 
152     public void write(java.io.File file, InputStream is) throws IOException;
153 
154 }