ch.elca.dependency.util
Class MyFile

java.lang.Object
  |
  +--java.io.File
        |
        +--ch.elca.dependency.util.MyFile
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class MyFile
extends java.io.File

Class MyFile used for a temporary directory which needs to be deleted on exit. The delete() method works recursively in case an instance of MyFile is a directory.

Version:
1.0-beta
Author:
Pawel Kowalski
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
MyFile(java.io.File parent, java.lang.String child)
          Creates a new MyFile instance.
MyFile(java.lang.String pathname)
          Creates a new MyFile instance.
 
Method Summary
 boolean createNewFile()
          Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist.
 boolean delete()
          Deletes the file or directory denoted by this abstract pathname.
 
Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createTempFile, createTempFile, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MyFile

public MyFile(java.lang.String pathname)
Creates a new MyFile instance.

Parameters:
pathname - a String value

MyFile

public MyFile(java.io.File parent,
              java.lang.String child)
Creates a new MyFile instance.

Parameters:
parent - a File value
child - a String value
Method Detail

delete

public boolean delete()
Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the contents of this directory will be deleted recursively.

Overrides:
delete in class java.io.File
Returns:
a boolean value

createNewFile

public boolean createNewFile()
                      throws java.io.IOException
Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. All necessary parent directories will also be created.

Overrides:
createNewFile in class java.io.File
Returns:
a boolean value
Throws:
java.io.IOException - if an error occurs


Copyright © 2003 ELCA Informatique SA. All Rights Reserved.