Rio Project 4.2 API Documentation



org.rioproject.resources.util
Class FileUtils

java.lang.Object
  extended by org.rioproject.resources.util.FileUtils

public class FileUtils
extends Object

Utilities for working with Files.


Constructor Summary
FileUtils()
           
 
Method Summary
static void checkDirectory(File dir, String description)
          Check that a directory exists, is a directory and can be written to
static void copy(File src, File dst)
          Copies one file to another
static String getFilePath(File f)
          Get the path from a File object
static String makeFileName(String root, String extension)
          Make a directory or file name
static void remove(File file)
          Remove a File
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

getFilePath

public static String getFilePath(File f)
Get the path from a File object

Parameters:
f - The file
Returns:
The canonical path. If there is an IOException getting the canonical path, return the absolute path

makeFileName

public static String makeFileName(String root,
                                  String extension)
Make a directory or file name

Parameters:
root - The root directory name
extension - The name of the extension
Returns:
A directory name

remove

public static void remove(File file)
Remove a File

Parameters:
file - A File object to remove

checkDirectory

public static void checkDirectory(File dir,
                                  String description)
                           throws IOException
Check that a directory exists, is a directory and can be written to

Parameters:
dir - The directory to check. If the directory does not exist, create it
description - A description of the directory, used for filling in details for IOException that may be thrown
Throws:
IOException - If the provided dir is not a directory, or if the directory cannt be written to
IllegalArgumentException - if the dir parameter is null

copy

public static void copy(File src,
                        File dst)
                 throws IOException
Copies one file to another

Parameters:
src - The source file
dst - The destination File. If the dst file does not exist, it is created
Throws:
IOException - If the copy fails

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.