com.armatiek.infofuze.stream.filesystem
Class AbstractFile

java.lang.Object
  extended by com.armatiek.infofuze.stream.filesystem.AbstractFile
All Implemented Interfaces:
FileIf
Direct Known Subclasses:
ArchiveFile, ArchiveFileEntry, CIFSFile, HTTPFile, LocalFile, ProxyFile, WebDAVFile

public abstract class AbstractFile
extends java.lang.Object
implements FileIf

Author:
Maarten Kroon

Constructor Summary
AbstractFile()
           
 
Method Summary
 boolean canRead()
          Tests whether the application can read the file.
 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.lang.String getMimeType()
          Returns the mime type/content type of the contents of the file.
 boolean hasContent()
          Tests whether this file has content.
 boolean isHidden()
          Tests whether this is a hidden file.
 java.util.Iterator<FileIf> listFiles()
          Returns an iterator of files and directories in the directory denoted by this file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.armatiek.infofuze.stream.filesystem.FileIf
equals, getInputStream, getName, getParent, getParentFile, getPath, isDirectory, isFile, lastModified, length
 

Constructor Detail

AbstractFile

public AbstractFile()
Method Detail

canRead

public boolean canRead()
Description copied from interface: FileIf
Tests whether the application can read the file.

Specified by:
canRead in interface FileIf
Returns:
true if and only if the file exists and can be read by the application; false otherwise

exists

public boolean exists()
Description copied from interface: FileIf
Tests whether the file or directory exists.

Specified by:
exists in interface FileIf
Returns:
true if and only if this file or directory exists; false otherwise

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Description copied from interface: FileIf
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.

Specified by:
getCharacterEncoding in interface FileIf
Returns:
a String specifying the name of the character encoding, for example, UTF-8

getMimeType

public java.lang.String getMimeType()
Description copied from interface: FileIf
Returns the mime type/content type of the contents of the file.

Specified by:
getMimeType in interface FileIf
Returns:
a String specifying the mime type, for example, text/html

hasContent

public boolean hasContent()
Description copied from interface: FileIf
Tests whether this file has content.

Specified by:
hasContent in interface FileIf
Returns:
true if this file has content.

isHidden

public boolean isHidden()
Description copied from interface: FileIf
Tests whether this is a hidden file. The exact definition of hidden is system-dependent.

Specified by:
isHidden in interface FileIf
Returns:
true if and only if this file is hidden according to the conventions of the underlying platform

listFiles

public java.util.Iterator<FileIf> listFiles()
Description copied from interface: FileIf
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.

Specified by:
listFiles in interface FileIf
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.