@Named public class DefaultFileProcessor extends Object implements FileProcessor
FileProcessor.ProgressListener
Constructor and Description |
---|
DefaultFileProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
copy(File source,
File target)
Copies the specified source file to the given target file.
|
long |
copy(File source,
File target,
FileProcessor.ProgressListener listener)
Copies the specified source file to the given target file.
|
boolean |
mkdirs(File directory)
Thread-safe variant of
File.mkdirs() . |
void |
move(File source,
File target)
Moves the specified source file to the given target file.
|
void |
write(File target,
InputStream source)
Writes the given stream to a file.
|
void |
write(File target,
String data)
Writes the given data to a file.
|
public DefaultFileProcessor()
public boolean mkdirs(File directory)
File.mkdirs()
. Creates the directory named by the given abstract pathname,
including any necessary but nonexistent parent directories. Note that if this operation fails it may have
succeeded in creating some of the necessary parent directories.mkdirs
in interface FileProcessor
directory
- The directory to create, may be null
.true
if and only if the directory was created, along with all necessary parent directories;
false
otherwisepublic void write(File target, String data) throws IOException
FileProcessor
write
in interface FileProcessor
target
- The file to write to, must not be null
. This file will be overwritten.data
- The data to write, may be null
.IOException
- If an I/O error occurs.public void write(File target, InputStream source) throws IOException
FileProcessor
write
in interface FileProcessor
target
- The file to write to, must not be null
. This file will be overwritten.source
- The stream to write to the file, must not be null
.IOException
- If an I/O error occurs.public void copy(File source, File target) throws IOException
FileProcessor
copy
in interface FileProcessor
source
- The file to copy from, must not be null
.target
- The file to copy to, must not be null
.IOException
- If an I/O error occurs.public long copy(File source, File target, FileProcessor.ProgressListener listener) throws IOException
FileProcessor
copy
in interface FileProcessor
source
- The file to copy from, must not be null
.target
- The file to copy to, must not be null
.listener
- The listener to notify about the copy progress, may be null
.IOException
- If an I/O error occurs.public void move(File source, File target) throws IOException
FileProcessor
move
in interface FileProcessor
source
- The file to move from, must not be null
.target
- The file to move to, must not be null
.IOException
- If an I/O error occurs.Copyright © 2010–2019 The Apache Software Foundation. All rights reserved.