|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.itr_rescue.dataGuard.localFileSystem.JFMFile
public abstract class JFMFile
This class is the base class of an File object. It is supposed to be implemented by every filesystem implementation. The methods implemented by this class are very similar to those offered by the java.io.File class found in the JDK. Even the comments are the same. Why? Because, IMHO, java.io.File represents a very good abstractisation of an file object but I can't use it, because of the way its implemented. Or ... I haven't found a way to use it yet. If somebody will point me to the proper documentation, i will be more than happy to study it, to see how can I improve my skills.
Field Summary | |
---|---|
protected java.lang.Object |
data
This object holds the data required for the implementing file to initialize itself. |
protected java.lang.String |
displayName
This parameter, if setted to a different value than null determines what the toString() method will return |
protected boolean |
marked
This parameter is set to true when the file is marked in the view. |
protected java.util.Hashtable<java.lang.String,java.lang.String> |
multiPart
This parameter contains the id of each file which this file has been splitted. |
Constructor Summary | |
---|---|
JFMFile(java.lang.Object data)
Constructor. |
Method Summary | |
---|---|
abstract boolean |
canRead()
Tests whether the application can read the file denoted by the abstract pathname. |
abstract boolean |
canWrite()
Tests whether the application can modify to the file denoted by the abstract pathname. |
abstract int |
compareTo(JFMFile pathname)
Compares two abstract pathnames lexicographically. |
int |
compareTo(java.lang.Object o)
Compares this abstract pathname to another object. |
abstract JFMFile |
createFile(java.lang.String name)
Creates the file named by the abstract pathname denoted by the parameter. |
abstract boolean |
delete()
Deletes the file or directory denoted by the abstract pathname. |
abstract boolean |
equals(java.lang.Object obj)
Tests this abstract pathname for equality with the given object. |
abstract boolean |
exists()
Tests whether the file or directory denoted by the abstract pathname exists. |
abstract JFMFile |
getAbsoluteFile()
Returns the absolute form of this abstract pathname. |
abstract java.lang.String |
getAbsolutePath()
Returns the absolute pathname string of this abstract pathname. |
abstract JFMFile |
getCanonicalFile()
Returns the canonical form of this abstract pathname. |
abstract java.lang.String |
getCanonicalPath()
Returns the canonical pathname string of this abstract pathname. |
java.lang.String |
getDisplayName()
Returns the display name |
java.io.File |
getFile()
gets the content of the JFMFile if it exists. |
abstract javax.swing.Icon |
getIcon()
Returns the filesystem's icon associated with this file, or null if it can't be determined. |
abstract java.io.InputStream |
getInputStream()
Returns an InputStream to read from this file, or null if it can't be done (the filesystem doesn't support it) |
abstract java.lang.String |
getMimeType()
This method returns the string that represents the mime-type of this file, or null if it can't be determined. |
java.util.Hashtable<java.lang.String,java.lang.String> |
getMultiPart()
gets the hashtbale multipart. |
abstract java.lang.String |
getName()
This string represents the short name of the file (e.g. |
abstract java.io.OutputStream |
getOutputStream()
Returns an OutputStream to write to this file, or null if the write operation isn't supported (or doesn;t make sense from the filesystem's point of view). |
abstract java.lang.String |
getParent()
Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory. |
abstract JFMFile |
getParentFile()
Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent
directory. |
abstract java.lang.String |
getPath()
Converts this abstract pathname into a pathname string. |
JFMFile |
getRootDriveFile()
This method returns the root directory of the filesystem of witch the file belongs to. |
abstract java.lang.String |
getSystemDisplayName()
Returns the system display name as returned by the filesystem viewer, or null |
abstract int |
hashCode()
Computes a hash code for this abstract pathname. |
abstract boolean |
isAbsolute()
Tests whether this abstract pathname is absolute. |
abstract boolean |
isDirectory()
Tests whether the file denoted by this abstract pathname is a directory. |
abstract boolean |
isFile()
Tests whether the file denoted by this abstract pathname is a normal file. |
abstract boolean |
isHidden()
Tests whether the file named by this abstract pathname is a hidden file. |
boolean |
isMarked()
Returns true if the file has been marked in the view, false otherwise |
abstract long |
lastModified()
Returns the time that the file denoted by this abstract pathname was last modified. |
abstract long |
length()
Returns the length of the file denoted by this abstract pathname. |
abstract JFMFile[] |
listFiles()
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname. |
abstract JFMFile |
mkdir(java.lang.String name)
Creates the directory named by the abstract pathname denoted by the parameter. |
void |
setDisplayName(java.lang.String displayName)
Sets the display name |
void |
setMarked(boolean flag)
Sets the marked flag. |
void |
setMultiPart(java.util.Hashtable<java.lang.String,java.lang.String> multiPart)
Sets the hashtbale multipart. |
java.lang.String |
toString()
If getDisplayName() return null it returns the pathname string of this abstract pathname. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object data
protected java.lang.String displayName
null
determines what the toString() method will return
protected boolean marked
protected java.util.Hashtable<java.lang.String,java.lang.String> multiPart
Constructor Detail |
---|
public JFMFile(java.lang.Object data)
Method Detail |
---|
public abstract JFMFile[] listFiles()
If this abstract pathname does not denote a directory, then this
method returns null
. Otherwise an array of
File
objects is returned, one for each file or directory in
the directory. Pathnames denoting the directory itself and the
directory's parent directory are not included in the result. Each
resulting abstract pathname is constructed from this abstract pathname
using the
constructor. Therefore if this pathname
is absolute then each resulting pathname is absolute; if this pathname
is relative then each resulting pathname will be relative to the same
directory.
File(File, String)
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
null
if this abstract pathname
does not denote a directory, or if an I/O error occurs.
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the directorypublic abstract java.io.InputStream getInputStream()
public abstract java.io.OutputStream getOutputStream()
public abstract java.lang.String getName()
public abstract java.lang.String getParent()
null
if this pathname does not name a parent directory.
The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
null
if this pathname
does not name a parentpublic abstract JFMFile getParentFile()
null
if this pathname does not name a parent
directory.
The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
null
if this pathname
does not name a parentpublic abstract java.lang.String getPath()
default name-separator character
to
separate the names in the name sequence.
public abstract boolean isAbsolute()
"/"
. On Microsoft Windows systems, a
pathname is absolute if its prefix is a drive specifier followed by
"\\"
, or if its prefix is "\\"
.
Some other filesystems implementations (FTP, NFS, SMB, etc.) can have their own definition
of the absolute pathname, ven though I would recommend sticking to the UNIX definition.
true
if this abstract pathname is absolute,
false
otherwisepublic abstract java.lang.String getAbsolutePath()
If this abstract pathname is already absolute, then the pathname
string is simply returned as if by the
method. If this abstract pathname is the empty abstract pathname then
the pathname string of the current user directory, which is named by the
system property getPath()
user.dir
, is returned. Otherwise this
pathname is resolved in a system-dependent way. On UNIX systems, a
relative pathname is made absolute by resolving it against the current
user directory. On Microsoft Windows systems, a relative pathname is made absolute
by resolving it against the current directory of the drive named by the
pathname, if any; if not, it is resolved against the current user
directory.
java.lang.SecurityException
- If a required system property value cannot be accessed.org.jfm.md.filesystems.JFMFile#isAbsolute()
public abstract JFMFile getAbsoluteFile()
java.lang.SecurityException
- If a required system property value cannot be accessed.public abstract java.lang.String getCanonicalPath() throws FSException
A canonical pathname is both absolute and unique. The precise
definition of canonical form is system-dependent. This method first
converts this pathname to absolute form if necessary, as if by invoking the
getAbsolutePath()
method, and then maps it to its unique form in a
system-dependent way. This typically involves removing redundant names
such as "." and ".." from the pathname, resolving
symbolic links (on UNIX platforms), and converting drive letters to a
standard case (on Microsoft Windows platforms).
Every pathname that denotes an existing file or directory has a unique canonical form. Every pathname that denotes a nonexistent file or directory also has a unique canonical form. The canonical form of the pathname of a nonexistent file or directory may be different from the canonical form of the same pathname after the file or directory is created. Similarly, the canonical form of the pathname of an existing file or directory may be different from the canonical form of the same pathname after the file or directory is deleted.
FSException
- If an filesystem error occurs, which is possible because the
construction of the canonical pathname may require
filesystem queries
java.lang.SecurityException
- If a required system property value cannot be accessed.public abstract JFMFile getCanonicalFile() throws FSException
FSException
- If an filesystem error occurs, which is possible because the
construction of the canonical pathname may require
filesystem queries
java.lang.SecurityException
- If a required system property value cannot be accessed.public abstract boolean isDirectory()
true
if and only if the file denoted by this
abstract pathname exists and is a directory;
false
otherwise
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the filepublic abstract boolean isFile()
true
if and only if the file denoted by this
abstract pathname exists and is a normal file;
false
otherwise
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the filepublic abstract boolean isHidden()
'.'
). On Microsoft Windows systems, a file is
considered to be hidden if it has been marked as such in the filesystem.
true
if and only if the file denoted by this
abstract pathname is hidden according to the conventions of the
underlying platform
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the filepublic abstract long lastModified()
long
value representing the time the 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
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the filepublic abstract long length()
0L
if the file does not exist
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the filepublic abstract int compareTo(JFMFile pathname)
pathname
- The abstract pathname to be compared to this abstract
pathname
public int compareTo(java.lang.Object o)
compareTo(JFMFile)
. Otherwise, it throws a
ClassCastException
, since abstract pathnames can only be
compared to abstract pathnames.
compareTo
in interface java.lang.Comparable
o
- The Object
to be compared to this abstract
pathname
ClassCastException
- if the argument is not an
abstract pathnameComparable
public abstract boolean equals(java.lang.Object obj)
true
if and only if the argument is not
null
and is an abstract pathname that denotes the same file
or directory as this abstract pathname. Whether or not two abstract
pathnames are equal depends upon the underlying system. On UNIX
systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows
systems it is not. With other filesystems implementation ... it's their responsability
to decide wether it should be case sensitive or not.
equals
in class java.lang.Object
obj
- The object to be compared with this abstract pathname
true
if and only if the objects are the same;
false
otherwisepublic abstract int hashCode()
1234321
. On Microsoft Windows systems, the hash
code is equal to the exclusive or of its pathname string,
convered to lower case, and the decimal value 1234321
.
hashCode
in class java.lang.Object
public java.lang.String toString()
getDisplayName()
return null it returns the pathname string of this abstract pathname.
This is just the string returned by the getPath()
method.
Otherwise it just returns the displayName.
toString
in class java.lang.Object
public abstract java.lang.String getSystemDisplayName()
public abstract java.lang.String getMimeType()
public JFMFile getRootDriveFile()
If the active filesystem is the local filesystem and is an Windows filesystem, this method should return the drive letter of the drive that this file belongs to. On Unix filesystems it will always return '/'. On other filesystems .... it will return whatever the one that implements it wants to.
public java.lang.String getDisplayName()
public void setDisplayName(java.lang.String displayName)
displayName
- String the new display namepublic abstract boolean canRead()
file
- The file that denotes the abstract pathname
true
if and only if the file specified by this
abstract pathname exists and can be read by the
application; false
otherwise
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the filepublic abstract boolean canWrite()
file
- The file that denotes the abstract pathname
true
if and only if the file system actually
contains a file denoted by this abstract pathname and
the application is allowed to write to the file;
false
otherwise.
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkWrite(java.lang.String)
method denies write access to the filepublic abstract boolean exists()
file
- The file that denotes the abstract pathname
true
if and only if the file or directory denoted
by this abstract pathname exists; false
otherwise
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkRead(java.lang.String)
method denies read access to the file or directorypublic abstract JFMFile mkdir(java.lang.String name)
file
- The file that denotes the abstract pathname
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkWrite(java.lang.String)
method does not permit the named directory to be createdpublic abstract JFMFile createFile(java.lang.String name)
file
- The file that denotes the abstract pathname
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkWrite(java.lang.String)
method does not permit the named directory to be createdpublic abstract boolean delete()
file
- The file that denotes the abstract pathname
true
if and only if the file or directory is
successfully deleted; false
otherwise
java.lang.SecurityException
- If a security manager exists and its SecurityManager.checkDelete(java.lang.String)
method denies
delete access to the filepublic abstract javax.swing.Icon getIcon()
public boolean isMarked()
public void setMarked(boolean flag)
flag
- public void setMultiPart(java.util.Hashtable<java.lang.String,java.lang.String> multiPart)
multiPart
- public java.util.Hashtable<java.lang.String,java.lang.String> getMultiPart()
public java.io.File getFile()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |