com.armatiek.infofuze.stream.filesystem
Interface FileIf

All Known Implementing Classes:
AbstractFile, ArchiveFile, ArchiveFileEntry, BZip2ArchiveFile, BZip2ArchiveFileEntry, CIFSFile, CSVFile, GzipArchiveFile, GzipArchiveFileEntry, HTTPFile, LocalFile, ProxyFile, TarArchiveFile, TarArchiveFileEntry, WebDAVFile, ZipArchiveFile, ZipArchiveFileEntry

public interface FileIf

Interface that must be implemented by all Infofuze file classes.

Author:
Maarten Kroon

Method Summary
 boolean canRead()
          Tests whether the application can read the file.
 boolean equals(java.lang.Object obj)
          Tests this file for equality with the given object.
 boolean exists()
          Tests whether the file or directory exists.
 java.lang.String getCharacterEncoding()
          Returns the name of the character encoding (MIME charset) of the character contents of this file.
 java.io.InputStream getInputStream()
          Returns the contents of the file as a byte stream.
 java.lang.String getMimeType()
          Returns the mime type/content type of the contents of the file.
 java.lang.String getName()
          Returns the name of the file.
 java.lang.String getParent()
          Returns the path of the parent of the file.
 FileIf getParentFile()
          Returns the parent of the file.
 java.lang.String getPath()
          Returns the path of the file.
 boolean hasContent()
          Tests whether this file has content.
 boolean isDirectory()
          Tests whether the file denoted by this abstract pathname is a directory.
 boolean isFile()
          Tests whether this file is a normal file.
 boolean isHidden()
          Tests whether this is a hidden file.
 long lastModified()
          Returns the time that this file was last modified.
 long length()
          Returns the length of this file.
 java.util.Iterator<FileIf> listFiles()
          Returns an iterator of files and directories in the directory denoted by this file.
 

Method Detail

canRead

boolean canRead()
Tests whether the application can read the file.

Returns:
true if and only if the file exists and can be read by the application; false otherwise

equals

boolean equals(java.lang.Object obj)
Tests this file for equality with the given object. Returns true if and only if the argument is not null and is a FileIf interface that denotes the same file or directory as this file. Whether or not two files are equal depends upon the underlying system.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object to be compared with this file
Returns:
true if and only if the objects are the same; false otherwise

exists

boolean exists()
Tests whether the file or directory exists.

Returns:
true if and only if this file or directory exists; false otherwise

getCharacterEncoding

java.lang.String getCharacterEncoding()
Returns the name of the character encoding (MIME charset) of the character contents of this file. See RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt) for more information about character encoding and MIME.

Returns:
a String specifying the name of the character encoding, for example, UTF-8

getMimeType

java.lang.String getMimeType()
Returns the mime type/content type of the contents of the file.

Returns:
a String specifying the mime type, for example, text/html

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns the contents of the file as a byte stream.

Returns:
an InputStream providing the contents of the file as a stream of bytes.
Throws:
java.io.IOException

getName

java.lang.String getName()
Returns the name of the file.

Returns:
a String specifying the name of the file.

getParent

java.lang.String getParent()
Returns the path of the parent of the file. This is just the last name in the pathname's name sequence.

Returns:
a String specifying the path of the file's parent

getParentFile

FileIf getParentFile()
Returns the parent of the file.

Returns:
the FileIf interface of this file's parent

getPath

java.lang.String getPath()
Returns the path of the file.

Returns:
a String specifying the path of this file

hasContent

boolean hasContent()
Tests whether this file has content.

Returns:
true if this file has content.

isDirectory

boolean isDirectory()
Tests whether the file denoted by this abstract pathname is a directory.

Returns:
true if and only if this file exists and is a directory; false otherwise

isFile

boolean isFile()
Tests whether this file is a normal file. A file is normal if it is not a directory and, in addition, satisfies other system-dependent criteria.

Returns:
true if and only if this file is a directory; false otherwise

isHidden

boolean isHidden()
Tests whether this is a hidden file. The exact definition of hidden is system-dependent.

Returns:
true if and only if this file is hidden according to the conventions of the underlying platform

lastModified

long lastModified()
Returns the time that this file was last modified.

Returns:
A long value representing the time this file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs

length

long length()
Returns the length of this file. The return value is unspecified if this pathname denotes a directory.

Returns:
The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist.

listFiles

java.util.Iterator<FileIf> listFiles()
Returns an iterator of files and directories in the directory denoted by this file. If this file does not denote a directory, then this method returns null. Otherwise an iterator of files is returned, one for each file or directory in the directory. Files denoting the directory itself and the directory's parent directory are not included in the result.

Returns:
An iterator of FileIf interfaces of the files and directories in the directory denoted by this file. The iterator will be empty if the directory is empty. Returns null if this file does not denote a directory, or if an I/O error occurs.