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