org.edg.data.reptor.storage
Class FileHandleLocalImpl

java.lang.Object
  extended byorg.edg.data.reptor.storage.FileHandleLocalImpl
All Implemented Interfaces:
FileHandle

public class FileHandleLocalImpl
extends java.lang.Object
implements FileHandle

FileHandleLocalImpl is the implementation of FileHandle for files available on a local file system based on the java.io.File class.

Version:
$Id: FileHandleLocalImpl.java,v 1.11 2004/05/13 14:23:06 jamesc Exp $
Author:
Erwin Laure, Peter Kunszt

Constructor Summary
FileHandleLocalImpl(java.net.URI uri)
          Constructs a new FileHandleLocalImpl
 
Method Summary
 void delete()
          Deletes the file.
 boolean exists()
          Check if the file exists
 FileInfo getFileInfo()
          Returns details about this file.
 java.net.URI getURI()
          Return the URI of the file.
 java.lang.String[] list()
          List the file.
 void mkdirs()
          Creates all necessary dirs for the file.
 java.lang.String toString()
          Returns a string representation of the FileHandle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileHandleLocalImpl

public FileHandleLocalImpl(java.net.URI uri)
                    throws org.edg.data.util.InvalidFileTypeException,
                           InvalidFileNameException
Constructs a new FileHandleLocalImpl

Parameters:
uri - the URI pointing to the file
Throws:
org.edg.data.util.InvalidFileTypeException - if the file identified by the URI is not local.
InvalidFileNameException - if the file uri is not legal for some reason
Method Detail

delete

public void delete()
            throws FileHandleException
Deletes the file.

Specified by:
delete in interface FileHandle
Throws:
FileHandleException - if an error during the delete occurs.

list

public java.lang.String[] list()
                        throws FileHandleException
List the file. If the file is a directory, list the contents of the directory.

Specified by:
list in interface FileHandle
Throws:
FileHandleException - if an error during the delete occurs.

exists

public boolean exists()
               throws FileHandleException
Check if the file exists

Specified by:
exists in interface FileHandle
Returns:
true if the file exists; false otherwise
Throws:
FileHandleException - if an error during the inquiry occurs.

getURI

public java.net.URI getURI()
Return the URI of the file.

Specified by:
getURI in interface FileHandle
Returns:
the URI of the file

getFileInfo

public FileInfo getFileInfo()
                     throws FileHandleException,
                            java.io.FileNotFoundException
Description copied from interface: FileHandle
Returns details about this file.

Specified by:
getFileInfo in interface FileHandle
Throws:
FileHandleException
java.io.FileNotFoundException
See Also:
FileHandle.getFileInfo()

mkdirs

public void mkdirs()
            throws FileHandleException
Creates all necessary dirs for the file.

Specified by:
mkdirs in interface FileHandle
Throws:
FileHandleException - if the creation fails

toString

public java.lang.String toString()
Returns a string representation of the FileHandle.