1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.util;
16  
17  import java.io.IOException;
18  import java.io.InputStream;
19  import java.io.Reader;
20  
21  import java.util.List;
22  import java.util.Properties;
23  
24  /**
25   * <a href="File.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   * @author Alexander Chow
29   */
30  public interface File {
31  
32      public void copyDirectory(String sourceDirName, String destinationDirName);
33  
34      public void copyDirectory(java.io.File source, java.io.File destination);
35  
36      public void copyFile(String source, String destination);
37  
38      public void copyFile(String source, String destination, boolean lazy);
39  
40      public void copyFile(java.io.File source, java.io.File destination);
41  
42      public void copyFile(
43          java.io.File source, java.io.File destination, boolean lazy);
44  
45      public java.io.File createTempFile();
46  
47      public java.io.File createTempFile(String extension);
48  
49      public String createTempFileName();
50  
51      public String createTempFileName(String extension);
52  
53      public String decodeSafeFileName(String fileName);
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 String encodeSafeFileName(String fileName);
64  
65      public boolean exists(String fileName);
66  
67      public boolean exists(java.io.File file);
68  
69      public String extractText(InputStream is, String fileName);
70  
71      public String getAbsolutePath(java.io.File file);
72  
73      public byte[] getBytes(java.io.File file) throws IOException;
74  
75      public byte[] getBytes(InputStream is) throws IOException;
76  
77      public byte[] getBytes(InputStream is, int bufferSize) throws IOException;
78  
79      public String getExtension(String fileName);
80  
81      public String getPath(String fullFileName);
82  
83      public String getShortFileName(String fullFileName);
84  
85      public boolean isAscii(java.io.File file) throws IOException;
86  
87      public String[] listDirs(String fileName);
88  
89      public String[] listDirs(java.io.File file);
90  
91      public String[] listFiles(String fileName);
92  
93      public String[] listFiles(java.io.File file);
94  
95      public void mkdirs(String pathName);
96  
97      public boolean move(String sourceFileName, String destinationFileName);
98  
99      public boolean move(java.io.File source, java.io.File destination);
100 
101     public String read(String fileName) throws IOException;
102 
103     public String read(java.io.File file) throws IOException;
104 
105     public String read(java.io.File file, boolean raw) throws IOException;
106 
107     public String replaceSeparator(String fileName);
108 
109     public java.io.File[] sortFiles(java.io.File[] files);
110 
111     public String stripExtension(String fileName);
112 
113     public List<String> toList(Reader reader);
114 
115     public List<String> toList(String fileName);
116 
117     public Properties toProperties(java.io.FileInputStream fis);
118 
119     public Properties toProperties(String fileName);
120 
121     public void write(String fileName, String s) throws IOException;
122 
123     public void write(String fileName, String s, boolean lazy)
124         throws IOException;
125 
126     public void write(String fileName, String s, boolean lazy, boolean append)
127         throws IOException;
128 
129     public void write(String pathName, String fileName, String s)
130         throws IOException;
131 
132     public void write(String pathName, String fileName, String s, boolean lazy)
133         throws IOException;
134 
135     public void write(
136             String pathName, String fileName, String s, boolean lazy,
137             boolean append)
138         throws IOException;
139 
140     public void write(java.io.File file, String s) throws IOException;
141 
142     public void write(java.io.File file, String s, boolean lazy)
143         throws IOException;
144 
145     public void write(java.io.File file, String s, boolean lazy, boolean append)
146         throws IOException;
147 
148     public void write(String fileName, byte[] bytes) throws IOException;
149 
150     public void write(java.io.File file, byte[] bytes) throws IOException;
151 
152     public void write(java.io.File file, byte[] bytes, int offset, int length)
153         throws IOException;
154 
155     public void write(String fileName, InputStream is) throws IOException;
156 
157     public void write(java.io.File file, InputStream is) throws IOException;
158 
159 }