net.metanotion.io
Class AbstractFile<F extends File,FS extends FileSystem>
java.lang.Object
net.metanotion.io.AbstractFile<F,FS>
- All Implemented Interfaces:
- Comparable<File>, Iterable<File>, File
public abstract class AbstractFile<F extends File,FS extends FileSystem>
- extends Object
- implements File
Abstract base class to implement common behaviors of a File, in particular files that delegate to
an underlying File object.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.metanotion.io.File |
copyTo, countChildren, getAttribute, getChild, getChildren, getParent, getShortName, isDirectory, isFile, length, listAttributes, listFiles, mkdir, mkdirs, setAttribute, setLength |
owner
protected final FS extends FileSystem owner
file
protected final File file
AbstractFile
public AbstractFile(FS fs,
File f)
iterator
public Iterator<File> iterator()
- Description copied from interface:
File
- List the files that are in the directory represented by this file.
If .isDirectory() != true, this iterator will not throw an exception and instead return an iterator with zero elements.
This is semantically duplicate to .listFiles() and is provided to implement the @see java.lang.Iterable interface.
- Specified by:
iterator in interface Iterable<File>- Specified by:
iterator in interface File
getFS
public FileSystem getFS()
- Description copied from interface:
File
- Gets the FileSystem object associated with this file.
- Specified by:
getFS in interface File
- Returns:
- FileSystem associated with this object.
createNewFile
public boolean createNewFile()
- Specified by:
createNewFile in interface File
delete
public boolean delete()
- Specified by:
delete in interface File
exists
public boolean exists()
- Specified by:
exists in interface File
compareTo
public int compareTo(File f)
- Description copied from interface:
File
- Compares two file names to see if they are identical
AND belong to the same file system.
- Specified by:
compareTo in interface Comparable<File>- Specified by:
compareTo in interface File
- Parameters:
f - File to compare to.
- Returns:
- 0 if not equal, -1 if this file is less than f, 1 otherwise.
renameTo
public boolean renameTo(File destination)
- Description copied from interface:
File
- Renames a file.
- Specified by:
renameTo in interface File
- Parameters:
destination - File to rename this to.
- Returns:
- true if it succeeds.