com.sun.jini.system
Class FileSystem

java.lang.Object
  extended by com.sun.jini.system.FileSystem

public class FileSystem
extends Object

Miscellaneous file system manipulation methods.

Author:
Sun Microsystems, Inc.

Constructor Summary
FileSystem()
           
 
Method Summary
static void destroy(File file, boolean proceed)
          Remove this completely.
private static void destroyDir(File dir, Collection errors)
          Perform the recursion for destroy.
static void ensureDir(String path)
          Ensure that the given path is a directory, creating it if necessary.
private static void handleError(Collection errors, File path)
          Handle an error, either by adding to the list, or if there is no list, throwing an IOException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystem

public FileSystem()
Method Detail

destroy

public static void destroy(File file,
                           boolean proceed)
                    throws IOException
Remove this completely. If the parameter is a directory, it is removed after recursively destroying all its contents, including subdirectories. If the named file does not exist, destroy simply returns.

Parameters:
proceed - Proceed in the face of errors; otherwise the first error stops the execution of the method.
Throws:
IOException - The list of files that couldn't be removed (in the detail string).

destroyDir

private static void destroyDir(File dir,
                               Collection errors)
                        throws IOException
Perform the recursion for destroy.

Throws:
IOException

handleError

private static void handleError(Collection errors,
                                File path)
                         throws IOException
Handle an error, either by adding to the list, or if there is no list, throwing an IOException.

Throws:
IOException

ensureDir

public static void ensureDir(String path)
                      throws IllegalArgumentException
Ensure that the given path is a directory, creating it if necessary. If the path exists it must be a directory. It the path does not exist this method uses File.mkdirs to create the directory along with any intermediate paths.

Throws:
IllegalArgumentException - if the path already exists but is not a directory, or it does not exist and cannot be created.


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.