org.apache.derby.iapi.services.io
Class FileUtil

java.lang.Object
  extended by org.apache.derby.iapi.services.io.FileUtil

public abstract class FileUtil
extends java.lang.Object

A set of public static methods for dealing with File objects.


Field Summary
private static int BUFFER_SIZE
           
 
Constructor Summary
FileUtil()
           
 
Method Summary
static boolean copyDirectory(java.io.File from, java.io.File to)
          Copy a directory and all of its contents.
static boolean copyDirectory(java.io.File from, java.io.File to, byte[] buffer, java.lang.String[] filter)
           
static boolean copyDirectory(StorageFactory storageFactory, StorageFile from, java.io.File to)
           
static boolean copyDirectory(StorageFactory storageFactory, StorageFile from, java.io.File to, byte[] buffer, java.lang.String[] filter, boolean copySubDirs)
           
static boolean copyDirectory(java.lang.String from, java.lang.String to)
           
static boolean copyDirectory(WritableStorageFactory storageFactory, java.io.File from, StorageFile to)
           
static boolean copyDirectory(WritableStorageFactory storageFactory, java.io.File from, StorageFile to, byte[] buffer, java.lang.String[] filter)
           
static boolean copyFile(java.io.File from, java.io.File to)
           
static boolean copyFile(java.io.File from, java.io.File to, byte[] buf)
           
static boolean copyFile(StorageFactory storageFactory, StorageFile from, java.io.File to)
           
static boolean copyFile(StorageFactory storageFactory, StorageFile from, java.io.File to, byte[] buf)
           
static boolean copyFile(WritableStorageFactory storageFactory, java.io.File from, StorageFile to)
           
static boolean copyFile(WritableStorageFactory storageFactory, java.io.File from, StorageFile to, byte[] buf)
           
static boolean copyFile(WritableStorageFactory storageFactory, StorageFile from, StorageFile to)
           
static boolean copyFile(WritableStorageFactory storageFactory, StorageFile from, StorageFile to, byte[] buf)
           
static java.io.File getAbsoluteFile(java.io.File root, java.lang.String path)
          Convert a file path into a File object with an absolute path relative to a passed in root.
static java.io.File newFile(java.io.File parent, java.lang.String name)
          A replacement for new File(File, String) that correctly implements the case when the first argument is null.
static boolean removeDirectory(java.io.File directory)
          Remove a directory and all of its contents.
static boolean removeDirectory(java.lang.String directory)
           
static java.lang.String stripProtocolFromFileName(java.lang.String originalName)
          Remove the leading 'file://' protocol from a filename which has been expressed as an URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

private static final int BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

FileUtil

public FileUtil()
Method Detail

removeDirectory

public static boolean removeDirectory(java.io.File directory)
Remove a directory and all of its contents. The results of executing File.delete() on a File object that represents a directory seems to be platform dependent. This method removes the directory and all of its contents.

Returns:
true if the complete directory was removed, false if it could not be. If false is returned then some of the files in the directory may have been removed.

removeDirectory

public static boolean removeDirectory(java.lang.String directory)

copyDirectory

public static boolean copyDirectory(java.io.File from,
                                    java.io.File to)
Copy a directory and all of its contents.


copyDirectory

public static boolean copyDirectory(java.lang.String from,
                                    java.lang.String to)

copyDirectory

public static boolean copyDirectory(java.io.File from,
                                    java.io.File to,
                                    byte[] buffer,
                                    java.lang.String[] filter)
Parameters:
filter - - array of names to not copy.

copyFile

public static boolean copyFile(java.io.File from,
                               java.io.File to)

copyFile

public static boolean copyFile(java.io.File from,
                               java.io.File to,
                               byte[] buf)

copyDirectory

public static boolean copyDirectory(StorageFactory storageFactory,
                                    StorageFile from,
                                    java.io.File to)

copyDirectory

public static boolean copyDirectory(StorageFactory storageFactory,
                                    StorageFile from,
                                    java.io.File to,
                                    byte[] buffer,
                                    java.lang.String[] filter,
                                    boolean copySubDirs)

copyFile

public static boolean copyFile(StorageFactory storageFactory,
                               StorageFile from,
                               java.io.File to)

copyFile

public static boolean copyFile(StorageFactory storageFactory,
                               StorageFile from,
                               java.io.File to,
                               byte[] buf)

copyDirectory

public static boolean copyDirectory(WritableStorageFactory storageFactory,
                                    java.io.File from,
                                    StorageFile to)

copyDirectory

public static boolean copyDirectory(WritableStorageFactory storageFactory,
                                    java.io.File from,
                                    StorageFile to,
                                    byte[] buffer,
                                    java.lang.String[] filter)

copyFile

public static boolean copyFile(WritableStorageFactory storageFactory,
                               java.io.File from,
                               StorageFile to)

copyFile

public static boolean copyFile(WritableStorageFactory storageFactory,
                               java.io.File from,
                               StorageFile to,
                               byte[] buf)

copyFile

public static boolean copyFile(WritableStorageFactory storageFactory,
                               StorageFile from,
                               StorageFile to)

copyFile

public static boolean copyFile(WritableStorageFactory storageFactory,
                               StorageFile from,
                               StorageFile to,
                               byte[] buf)

getAbsoluteFile

public static java.io.File getAbsoluteFile(java.io.File root,
                                           java.lang.String path)
Convert a file path into a File object with an absolute path relative to a passed in root. If path is absolute then a file object constructed from new File(path) is returned, otherwise a file object is returned from new File(root, path) if root is not null, otherwise null is returned.


newFile

public static java.io.File newFile(java.io.File parent,
                                   java.lang.String name)
A replacement for new File(File, String) that correctly implements the case when the first argument is null. The documentation for java.io.File says that new File((File) null, name) is the same as new File(name). This is not the case in pre 1.1.8 vms, a NullPointerException is thrown instead.


stripProtocolFromFileName

public static java.lang.String stripProtocolFromFileName(java.lang.String originalName)
Remove the leading 'file://' protocol from a filename which has been expressed as an URL. If the filename is not an URL, then nothing is done. Otherwise, an URL like 'file:///tmp/foo.txt' is transformed into the legal file name '/tmp/foo.txt'.


Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.