com.evanmclean.evlib.io
Class FileStructureCopier

java.lang.Object
  extended by com.evanmclean.evlib.io.FileStructureCopier

public class FileStructureCopier
extends Object

Recursively copies a set of files. Can implement your own error handling.

Author:
Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Constructor Summary
FileStructureCopier()
           
 
Method Summary
 boolean copy(File from, File to)
          Perform recursive copying.
protected  void errorHandler(File from, File to, IOException exception)
          By default, throws the IOException that was passed in to it.
protected  boolean filter(File from, File to)
          Can be overridden to filter which files and folders to copy.
protected  void postCopy(File from, File to)
          Can be overridden to perform processing once a file or folder has been successfully copied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileStructureCopier

public FileStructureCopier()
Method Detail

copy

public final boolean copy(File from,
                          File to)
                   throws IOException
Perform recursive copying.

Parameters:
from -
to -
Returns:
False if there was an error copying any file at all.
Throws:
IOException - Other errors.

errorHandler

protected void errorHandler(File from,
                            File to,
                            IOException exception)
                     throws IOException
By default, throws the IOException that was passed in to it. Can be overridden to perform other behaviour.

Parameters:
from -
to -
exception -
Throws:
IOException

filter

protected boolean filter(File from,
                         File to)
Can be overridden to filter which files and folders to copy.

Parameters:
from -
to -
Returns:
Return true if we should copy this file or folder.

postCopy

protected void postCopy(File from,
                        File to)
Can be overridden to perform processing once a file or folder has been successfully copied.

Parameters:
from -
to -