net.metanotion.io
Interface File

All Superinterfaces:
Comparable<File>, Iterable<File>
All Known Implementing Classes:
AbstractFile

public interface File
extends Comparable<File>, Iterable<File>


Method Summary
 int compareTo(File f)
          Compares two file names to see if they are identical AND belong to the same file system.
 boolean copyTo(File f)
           
 int countChildren()
          The number of files in the directory represented by this file.
 boolean createNewFile()
           
 boolean delete()
           
 boolean exists()
           
 Object getAttribute(String attrib)
           
 File getChild(String name)
          If ".isDirectory() == true" then name is local name of a file in the directory, and the corresponding file will be returned.
 File[] getChildren()
          List the files that are in the directory represented by this file.
 FileSystem getFS()
          Gets the FileSystem object associated with this file.
 File getParent()
           
 String getShortName()
           
 boolean isDirectory()
          Determine if there are "sub" files associated with this file.
 boolean isFile()
          Determine if there is a byte stream associated with this file.
 Iterator<File> iterator()
          List the files that are in the directory represented by this file.
 long length()
           
 Iterator<String> listAttributes()
           
 Iterator<File> listFiles()
          List the files that are in the directory represented by this file.
 boolean mkdir()
           
 boolean mkdirs()
           
 boolean renameTo(File destination)
          Renames a file.
 void setAttribute(String attrib, Object value)
           
 boolean setLength(long length)
           
 

Method Detail

compareTo

int compareTo(File f)
Compares two file names to see if they are identical AND belong to the same file system.

Specified by:
compareTo in interface Comparable<File>
Parameters:
f - File to compare to.
Returns:
0 if not equal, -1 if this file is less than f, 1 otherwise.

renameTo

boolean renameTo(File destination)
                 throws UnsupportedOperationException
Renames a file.

Parameters:
destination - File to rename this to.
Returns:
true if it succeeds.
Throws:
UnsupportedOperationException

copyTo

boolean copyTo(File f)
               throws UnsupportedOperationException
Throws:
UnsupportedOperationException

createNewFile

boolean createNewFile()

delete

boolean delete()

getFS

FileSystem getFS()
Gets the FileSystem object associated with this file.

Returns:
FileSystem associated with this object.

exists

boolean exists()

getParent

File getParent()

isFile

boolean isFile()
Determine if there is a byte stream associated with this file. In general, a consumer should not assume that .isFile() != .isDirectory()

Returns:
true is there is(or can be) a byte stream associated with this file.

isDirectory

boolean isDirectory()
Determine if there are "sub" files associated with this file. In general, a consumer should not assume that .isFile() != .isDirectory()

Returns:
true is there is(or can be) a list of sub files.

getChild

File getChild(String name)
If ".isDirectory() == true" then name is local name of a file in the directory, and the corresponding file will be returned. Also, the following identities should ALWAYS hold aFile.getChild(file).getShortName().equals(file) And aFile.getChild(file).getParent().equals(aFile)

Parameters:
name - Short name of a file in the directory represented by this file.
Returns:
The corresponding file from the directory.

getShortName

String getShortName()

setAttribute

void setAttribute(String attrib,
                  Object value)
                  throws UnsupportedOperationException,
                         IllegalArgumentException
Throws:
UnsupportedOperationException
IllegalArgumentException

getAttribute

Object getAttribute(String attrib)

listAttributes

Iterator<String> listAttributes()

listFiles

Iterator<File> listFiles()
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.


iterator

Iterator<File> iterator()
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>

getChildren

File[] getChildren()
List the files that are in the directory represented by this file. In general this should return the same files as .listFiles() (as determined by .equals()). This method is specified in the interface to allow file systems that can provide a direct and efficient implementation of this method to do so directly.


countChildren

int countChildren()
The number of files in the directory represented by this file. It should always hold that: if (aFile.isDirectory() == false) then (aFile.countChildren() == 0) And aFile.getChildren().length == aFile.countChildren()


mkdir

boolean mkdir()

mkdirs

boolean mkdirs()

length

long length()

setLength

boolean setLength(long length)