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 String createTempFileName();
56  
57      public String createTempFileName(String extension);
58  
59      public boolean delete(String file);
60  
61      public boolean delete(java.io.File file);
62  
63      public void deltree(String directory);
64  
65      public void deltree(java.io.File directory);
66  
67      public boolean exists(String fileName);
68  
69      public boolean exists(java.io.File file);
70  
71      public String extractText(InputStream is, String fileExt);
72  
73      public String getAbsolutePath(java.io.File file);
74  
75      public byte[] getBytes(java.io.File file) throws IOException;
76  
77      public byte[] getBytes(InputStream is) throws IOException;
78  
79      public byte[] getBytes(InputStream is, int bufferSize) throws IOException;
80  
81      public String getExtension(String fileName);
82  
83      public String getPath(String fullFileName);
84  
85      public String getShortFileName(String fullFileName);
86  
87      public boolean isAscii(java.io.File file) throws IOException;
88  
89      public String[] listDirs(String fileName);
90  
91      public String[] listDirs(java.io.File file);
92  
93      public String[] listFiles(String fileName);
94  
95      public String[] listFiles(java.io.File file);
96  
97      public void mkdirs(String pathName);
98  
99      public boolean move(String sourceFileName, String destinationFileName);
100 
101     public boolean move(java.io.File source, java.io.File destination);
102 
103     public String read(String fileName) throws IOException;
104 
105     public String read(java.io.File file) throws IOException;
106 
107     public String read(java.io.File file, boolean raw) throws IOException;
108 
109     public String replaceSeparator(String fileName);
110 
111     public java.io.File[] sortFiles(java.io.File[] files);
112 
113     public String stripExtension(String fileName);
114 
115     public List<String> toList(Reader reader);
116 
117     public List<String> toList(String fileName);
118 
119     public Properties toProperties(java.io.FileInputStream fis);
120 
121     public Properties toProperties(String fileName);
122 
123     public void write(String fileName, String s) throws IOException;
124 
125     public void write(String fileName, String s, boolean lazy)
126         throws IOException;
127 
128     public void write(String fileName, String s, boolean lazy, boolean append)
129         throws IOException;
130 
131     public void write(String pathName, String fileName, String s)
132         throws IOException;
133 
134     public void write(String pathName, String fileName, String s, boolean lazy)
135         throws IOException;
136 
137     public void write(
138             String pathName, String fileName, String s, boolean lazy,
139             boolean append)
140         throws IOException;
141 
142     public void write(java.io.File file, String s) throws IOException;
143 
144     public void write(java.io.File file, String s, boolean lazy)
145         throws IOException;
146 
147     public void write(java.io.File file, String s, boolean lazy, boolean append)
148         throws IOException;
149 
150     public void write(String fileName, byte[] bytes) throws IOException;
151 
152     public void write(java.io.File file, byte[] bytes) throws IOException;
153 
154     public void write(String fileName, InputStream is) throws IOException;
155 
156     public void write(java.io.File file, InputStream is) throws IOException;
157 
158 }