|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.silverpeas.process.io.file.AbstractFileHandler
org.silverpeas.process.io.file.FileHandler
public class FileHandler
This is an handler that permits to perform transactional file manipulations. It has to be used
exclusively in classes that implements SilverpeasProcess
. In a standard use,
getHandledFile
method has to be called to obtain a HandledFile
instance
(@see HandledFile
).
Constructor Summary | |
---|---|
protected |
FileHandler(ProcessSession session)
Default constructor |
Method Summary | |
---|---|
protected void |
cleanDirectory(FileBasePath basePath,
File directory)
|
protected boolean |
contentEquals(FileBasePath basePath,
File file1,
File file2)
Both of given files are handled |
protected boolean |
contentEquals(File file1,
FileBasePath basePath,
File file2)
The first given file is not handled. |
protected void |
copyFile(FileBasePath basePath,
File srcFile,
File destFile)
Both of given files are handled |
protected void |
copyFile(FileBasePath basePath,
File srcFile,
FileBasePath basePathDest,
File destFile)
Both of given files are handled |
protected long |
copyFile(FileBasePath basePath,
File input,
OutputStream output)
The given file is handled |
void |
copyFile(File srcFile,
HandledFile destFile)
The first given file is not handled. |
protected void |
copyInputStreamToFile(FileBasePath basePath,
File file,
InputStream inputStream,
boolean append)
|
protected void |
copyURLToFile(URL source,
FileBasePath basePath,
File destination)
The given file is handled |
protected boolean |
delete(FileBasePath basePath,
File file)
|
protected boolean |
exists(FileBasePath basePath,
File file,
String... names)
Indicates if the file exists in session or in real path. |
File |
getFile(File file,
String... names)
|
File |
getFile(String... names)
|
HandledFile |
getHandledFile(FileBasePath basePath,
File file,
String... names)
Gets the handled file that represents the file in session path if exists or if the file doesn't exist into destination path. |
HandledFile |
getHandledFile(FileBasePath basePath,
String... names)
Gets the handled file that represents the file in session path if exists or if the file doesn't exist into destination path. |
File |
getSessionTemporaryFile(String... names)
Gets a temporary file contained in session path. |
protected boolean |
isFileNewer(FileBasePath basePath,
File file,
Date date)
|
protected boolean |
isFileNewer(FileBasePath basePath,
File file,
File reference)
|
protected boolean |
isFileNewer(FileBasePath basePath,
File file,
long timeMillis)
|
protected boolean |
isFileOlder(FileBasePath basePath,
File file,
Date date)
|
protected boolean |
isFileOlder(FileBasePath basePath,
File file,
File reference)
|
protected boolean |
isFileOlder(FileBasePath basePath,
File file,
long timeMillis)
|
protected Collection<File> |
listFiles(FileBasePath basePath,
File directory,
boolean recursive,
String... extensions)
|
protected Collection<File> |
listFiles(FileBasePath basePath,
File directory,
org.apache.commons.io.filefilter.IOFileFilter fileFilter,
org.apache.commons.io.filefilter.IOFileFilter dirFilter)
|
protected Collection<File> |
listFiles(FileBasePath basePath,
File directory,
String... extensions)
Adding this simple method based on listFiles from @see FileUtils |
protected void |
moveFile(FileBasePath basePath,
File srcFile,
File destFile)
Both of given files are handled |
protected void |
moveFile(FileBasePath basePath,
File srcFile,
FileBasePath baseDestPath,
File destFile)
Both of given files are handled |
void |
moveFile(File srcFile,
HandledFile destFile)
The first given file is not handled. |
protected InputStream |
openInputStream(FileBasePath basePath,
File file)
|
protected OutputStream |
openOutputStream(FileBasePath basePath,
File file)
|
protected OutputStream |
openOutputStream(FileBasePath basePath,
File file,
boolean append)
|
protected byte[] |
readFileToByteArray(FileBasePath basePath,
File file)
|
protected String |
readFileToString(FileBasePath basePath,
File file)
|
protected String |
readFileToString(FileBasePath basePath,
File file,
String encoding)
|
protected List<String> |
readLines(FileBasePath basePath,
File file)
|
protected List<String> |
readLines(FileBasePath basePath,
File file,
String encoding)
|
protected long |
sizeOf(FileBasePath basePath,
File file)
|
protected long |
sizeOfDirectory(FileBasePath basePath,
File directory)
|
protected void |
touch(FileBasePath basePath,
File file,
String... names)
|
protected boolean |
waitFor(FileBasePath basePath,
File file,
int seconds)
|
protected void |
write(FileBasePath basePath,
File file,
CharSequence data)
|
protected void |
write(FileBasePath basePath,
File file,
CharSequence data,
boolean append)
|
protected void |
write(FileBasePath basePath,
File file,
CharSequence data,
String encoding)
|
protected void |
write(FileBasePath basePath,
File file,
CharSequence data,
String encoding,
boolean append)
|
protected void |
writeByteArrayToFile(FileBasePath basePath,
File file,
byte[] data)
|
protected void |
writeByteArrayToFile(FileBasePath basePath,
File file,
byte[] data,
boolean append)
|
protected void |
writeLines(FileBasePath basePath,
File file,
Collection<?> lines)
|
protected void |
writeLines(FileBasePath basePath,
File file,
Collection<?> lines,
boolean append)
|
protected void |
writeLines(FileBasePath basePath,
File file,
Collection<?> lines,
String lineEnding)
|
protected void |
writeLines(FileBasePath basePath,
File file,
Collection<?> lines,
String lineEnding,
boolean append)
|
protected void |
writeLines(FileBasePath basePath,
File file,
String encoding,
Collection<?> lines)
|
protected void |
writeLines(FileBasePath basePath,
File file,
String encoding,
Collection<?> lines,
boolean append)
|
protected void |
writeLines(FileBasePath basePath,
File file,
String encoding,
Collection<?> lines,
String lineEnding)
|
protected void |
writeLines(FileBasePath basePath,
File file,
String encoding,
Collection<?> lines,
String lineEnding,
boolean append)
|
protected void |
writeStringToFile(FileBasePath basePath,
File file,
String data)
|
protected void |
writeStringToFile(FileBasePath basePath,
File file,
String data,
boolean append)
|
protected void |
writeStringToFile(FileBasePath basePath,
File file,
String data,
String encoding)
|
protected void |
writeStringToFile(FileBasePath basePath,
File file,
String data,
String encoding,
boolean append)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FileHandler(ProcessSession session)
session
- Method Detail |
---|
public File getFile(String... names)
FileUtils
public File getFile(File file, String... names)
FileUtils
public File getSessionTemporaryFile(String... names)
public HandledFile getHandledFile(FileBasePath basePath, String... names)
basePath
- names
- relative path from basePath parampublic HandledFile getHandledFile(FileBasePath basePath, File file, String... names)
basePath
- file
- the file or path whose the start of file path is equals to the root file path
defined by basePath paramnames
- relative path from basePath paramprotected boolean exists(FileBasePath basePath, File file, String... names)
FileUtils
protected OutputStream openOutputStream(FileBasePath basePath, File file) throws Exception
Exception
FileUtils
protected OutputStream openOutputStream(FileBasePath basePath, File file, boolean append) throws Exception
Exception
FileUtils
protected InputStream openInputStream(FileBasePath basePath, File file) throws Exception
Exception
FileUtils
protected void touch(FileBasePath basePath, File file, String... names) throws Exception
Exception
FileUtils
protected Collection<File> listFiles(FileBasePath basePath, File directory, String... extensions)
basePath
- directory
- extensions
-
protected Collection<File> listFiles(FileBasePath basePath, File directory, boolean recursive, String... extensions)
FileUtils
protected Collection<File> listFiles(FileBasePath basePath, File directory, org.apache.commons.io.filefilter.IOFileFilter fileFilter, org.apache.commons.io.filefilter.IOFileFilter dirFilter)
FileUtils
protected boolean contentEquals(FileBasePath basePath, File file1, File file2) throws Exception
Exception
FileUtils
protected boolean contentEquals(File file1, FileBasePath basePath, File file2) throws Exception
Exception
FileUtils
protected void copyFile(FileBasePath basePath, File srcFile, File destFile) throws Exception
Exception
FileUtils
protected void copyFile(FileBasePath basePath, File srcFile, FileBasePath basePathDest, File destFile) throws Exception
Exception
FileUtils
public void copyFile(File srcFile, HandledFile destFile) throws Exception
Exception
FileUtils
protected long copyFile(FileBasePath basePath, File input, OutputStream output) throws Exception
Exception
FileUtils
protected void copyURLToFile(URL source, FileBasePath basePath, File destination) throws Exception
Exception
FileUtils
protected boolean delete(FileBasePath basePath, File file) throws Exception
Exception
FileUtils
protected void cleanDirectory(FileBasePath basePath, File directory) throws Exception
Exception
FileUtils
protected boolean waitFor(FileBasePath basePath, File file, int seconds)
FileUtils
protected String readFileToString(FileBasePath basePath, File file) throws Exception
Exception
FileUtils
protected String readFileToString(FileBasePath basePath, File file, String encoding) throws Exception
Exception
FileUtils
protected byte[] readFileToByteArray(FileBasePath basePath, File file) throws Exception
Exception
FileUtils
protected List<String> readLines(FileBasePath basePath, File file) throws Exception
Exception
FileUtils
protected List<String> readLines(FileBasePath basePath, File file, String encoding) throws Exception
Exception
FileUtils
protected void writeStringToFile(FileBasePath basePath, File file, String data) throws Exception
Exception
FileUtils
protected void writeStringToFile(FileBasePath basePath, File file, String data, String encoding) throws Exception
Exception
FileUtils
protected void writeStringToFile(FileBasePath basePath, File file, String data, boolean append) throws Exception
Exception
FileUtils
protected void writeStringToFile(FileBasePath basePath, File file, String data, String encoding, boolean append) throws Exception
Exception
FileUtils
protected void write(FileBasePath basePath, File file, CharSequence data) throws Exception
Exception
FileUtils
protected void write(FileBasePath basePath, File file, CharSequence data, boolean append) throws Exception
Exception
FileUtils
protected void write(FileBasePath basePath, File file, CharSequence data, String encoding) throws Exception
Exception
FileUtils
protected void write(FileBasePath basePath, File file, CharSequence data, String encoding, boolean append) throws Exception
Exception
FileUtils
protected void writeByteArrayToFile(FileBasePath basePath, File file, byte[] data) throws Exception
Exception
FileUtils
protected void writeByteArrayToFile(FileBasePath basePath, File file, byte[] data, boolean append) throws Exception
Exception
FileUtils
protected void copyInputStreamToFile(FileBasePath basePath, File file, InputStream inputStream, boolean append) throws Exception
Exception
FileUtils
protected void writeLines(FileBasePath basePath, File file, Collection<?> lines) throws Exception
Exception
FileUtils
protected void writeLines(FileBasePath basePath, File file, Collection<?> lines, boolean append) throws Exception
Exception
FileUtils
protected void writeLines(FileBasePath basePath, File file, Collection<?> lines, String lineEnding) throws Exception
Exception
FileUtils
protected void writeLines(FileBasePath basePath, File file, Collection<?> lines, String lineEnding, boolean append) throws Exception
Exception
FileUtils
protected void writeLines(FileBasePath basePath, File file, String encoding, Collection<?> lines) throws Exception
Exception
FileUtils
protected void writeLines(FileBasePath basePath, File file, String encoding, Collection<?> lines, boolean append) throws Exception
Exception
FileUtils
protected void writeLines(FileBasePath basePath, File file, String encoding, Collection<?> lines, String lineEnding) throws Exception
Exception
FileUtils
protected void writeLines(FileBasePath basePath, File file, String encoding, Collection<?> lines, String lineEnding, boolean append) throws Exception
Exception
FileUtils
public void moveFile(File srcFile, HandledFile destFile) throws Exception
Exception
FileUtils
protected void moveFile(FileBasePath basePath, File srcFile, File destFile) throws Exception
Exception
FileUtils
protected void moveFile(FileBasePath basePath, File srcFile, FileBasePath baseDestPath, File destFile) throws Exception
Exception
FileUtils
protected long sizeOf(FileBasePath basePath, File file)
FileUtils
protected long sizeOfDirectory(FileBasePath basePath, File directory)
FileUtils
protected boolean isFileNewer(FileBasePath basePath, File file, File reference)
FileUtils
protected boolean isFileNewer(FileBasePath basePath, File file, Date date)
FileUtils
protected boolean isFileNewer(FileBasePath basePath, File file, long timeMillis)
FileUtils
protected boolean isFileOlder(FileBasePath basePath, File file, File reference)
FileUtils
protected boolean isFileOlder(FileBasePath basePath, File file, Date date)
FileUtils
protected boolean isFileOlder(FileBasePath basePath, File file, long timeMillis)
FileUtils
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |