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