1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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   */
39  public interface File {
40  
41      public void copyDirectory(String sourceDirName, String destinationDirName);
42  
43      public void copyDirectory(java.io.File source, java.io.File destination);
44  
45      public void copyFile(String source, String destination);
46  
47      public void copyFile(String source, String destination, boolean lazy);
48  
49      public void copyFile(java.io.File source, java.io.File destination);
50  
51      public void copyFile(
52          java.io.File source, java.io.File destination, boolean lazy);
53  
54      public java.io.File createTempFile();
55  
56      public java.io.File createTempFile(String extension);
57  
58      public String createTempFileName();
59  
60      public String createTempFileName(String extension);
61  
62      public boolean delete(String file);
63  
64      public boolean delete(java.io.File file);
65  
66      public void deltree(String directory);
67  
68      public void deltree(java.io.File directory);
69  
70      public boolean exists(String fileName);
71  
72      public boolean exists(java.io.File file);
73  
74      public String extractText(InputStream is, String fileExt);
75  
76      public String getAbsolutePath(java.io.File file);
77  
78      public byte[] getBytes(java.io.File file) throws IOException;
79  
80      public byte[] getBytes(InputStream is) throws IOException;
81  
82      public byte[] getBytes(InputStream is, int bufferSize) throws IOException;
83  
84      public String getExtension(String fileName);
85  
86      public String getPath(String fullFileName);
87  
88      public String getShortFileName(String fullFileName);
89  
90      public boolean isAscii(java.io.File file) throws IOException;
91  
92      public String[] listDirs(String fileName);
93  
94      public String[] listDirs(java.io.File file);
95  
96      public String[] listFiles(String fileName);
97  
98      public String[] listFiles(java.io.File file);
99  
100     public void mkdirs(String pathName);
101 
102     public boolean move(String sourceFileName, String destinationFileName);
103 
104     public boolean move(java.io.File source, java.io.File destination);
105 
106     public String read(String fileName) throws IOException;
107 
108     public String read(java.io.File file) throws IOException;
109 
110     public String read(java.io.File file, boolean raw) throws IOException;
111 
112     public String replaceSeparator(String fileName);
113 
114     public java.io.File[] sortFiles(java.io.File[] files);
115 
116     public String stripExtension(String fileName);
117 
118     public List<String> toList(Reader reader);
119 
120     public List<String> toList(String fileName);
121 
122     public Properties toProperties(java.io.FileInputStream fis);
123 
124     public Properties toProperties(String fileName);
125 
126     public void write(String fileName, String s) throws IOException;
127 
128     public void write(String fileName, String s, boolean lazy)
129         throws IOException;
130 
131     public void write(String fileName, String s, boolean lazy, boolean append)
132         throws IOException;
133 
134     public void write(String pathName, String fileName, String s)
135         throws IOException;
136 
137     public void write(String pathName, String fileName, String s, boolean lazy)
138         throws IOException;
139 
140     public void write(
141             String pathName, String fileName, String s, boolean lazy,
142             boolean append)
143         throws IOException;
144 
145     public void write(java.io.File file, String s) throws IOException;
146 
147     public void write(java.io.File file, String s, boolean lazy)
148         throws IOException;
149 
150     public void write(java.io.File file, String s, boolean lazy, boolean append)
151         throws IOException;
152 
153     public void write(String fileName, byte[] bytes) throws IOException;
154 
155     public void write(java.io.File file, byte[] bytes) throws IOException;
156 
157     public void write(String fileName, InputStream is) throws IOException;
158 
159     public void write(java.io.File file, InputStream is) throws IOException;
160 
161 }