com.Ostermiller.util Java Utilities


com.Ostermiller.util
Class FileHelper

java.lang.Object
  extended by com.Ostermiller.util.FileHelper

public class FileHelper
extends Object

Utilities for File manipulation. More information about this class is available from ostermiller.org.

Since:
ostermillerutils 1.00.00
Author:
Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities

Constructor Summary
FileHelper()
           
 
Method Summary
static void move(File from, File to)
          Move a file from one location to another.
static void move(File from, File to, boolean overwrite)
          Move a file from one location to another.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHelper

public FileHelper()
Method Detail

move

public static void move(File from,
                        File to)
                 throws IOException
Move a file from one location to another. An attempt is made to rename the file and if that fails, the file is copied and the old file deleted. If the destination file already exists, an exception will be thrown.

Parameters:
from - file which should be moved.
to - desired destination of the file.
Throws:
IOException - if an error occurs.
Since:
ostermillerutils 1.00.00

move

public static void move(File from,
                        File to,
                        boolean overwrite)
                 throws IOException
Move a file from one location to another. An attempt is made to rename the file and if that fails, the file is copied and the old file deleted.

Parameters:
from - file which should be moved.
to - desired destination of the file.
overwrite - If false, an exception will be thrown rather than overwrite a file.
Throws:
IOException - if an error occurs.
Since:
ostermillerutils 1.00.00

com.Ostermiller.util Java Utilities


Copyright © 2001-2012 by Stephen Ostermiller