|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.mucommander.file.AbstractFile
com.mucommander.file.impl.nfs.NFSFile
public class NFSFile
NFSFile provides access to files located on an NFS/WebNFS server.
The associated FileURL scheme is FileProtocols.NFS. The host part of the URL designates the
NFS server. The path separator is '/'.
Here are a few examples of valid NFS URLs:
nfs://garfield/stuff/
nfs://192.168.1.1:2049/stuff/somefile
Access to NFS files is provided by the Yanfs library (formerly WebNFS) distributed under the BSD
license. The getUnderlyingFileObject() method allows to retrieve a com.sun.xfile.XFile instance
corresponding to this NFSFile.
| Nested Class Summary | |
|---|---|
static class |
NFSFile.NFSRandomAccessInputStream
NFSRandomAccessInputStream extends RandomAccessInputStream to provide random read access to an NFSFile. |
static class |
NFSFile.NFSRandomAccessOutputStream
NFSRandomAccessOutputStream extends RandomAccessOutputStream to provide random write access to an NFSFile. |
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_NFS_PROTOCOL
Default transport protocol |
static java.lang.String |
DEFAULT_NFS_VERSION
Default NFS version |
static java.lang.String |
NFS_PROTOCOL_AUTO
'Auto' transport protocol: TCP is tried first and if the connection cannot be established, falls back to UDP |
static java.lang.String |
NFS_PROTOCOL_PROPERTY_NAME
Name of the NFS transport protocol property |
static java.lang.String |
NFS_PROTOCOL_TCP
TCP transport protocol |
static java.lang.String |
NFS_PROTOCOL_UDP
UDP transport protocol |
static java.lang.String |
NFS_VERSION_2
NFS version 2 |
static java.lang.String |
NFS_VERSION_3
NFS version 3 |
static java.lang.String |
NFS_VERSION_PROPERTY_NAME
Name of the NFS version property |
static java.lang.String |
SEPARATOR
|
| Fields inherited from class com.mucommander.file.AbstractFile |
|---|
DEFAULT_SEPARATOR, fileURL, IO_BUFFER_SIZE, MUST_HINT, MUST_NOT_HINT, SHOULD_HINT, SHOULD_NOT_HINT, windowsDriveRootPattern |
| Fields inherited from interface com.mucommander.file.PermissionTypes |
|---|
EXECUTE_PERMISSION, READ_PERMISSION, WRITE_PERMISSION |
| Fields inherited from interface com.mucommander.file.PermissionAccesses |
|---|
GROUP_ACCESS, OTHER_ACCESS, USER_ACCESS |
| Constructor Summary | |
|---|---|
NFSFile(FileURL fileURL)
Creates a new instance of NFSFile. |
|
| Method Summary | |
|---|---|
boolean |
canChangeDate()
Always returns false (date cannot be changed). |
boolean |
canGetGroup()
Always returns false, this information is not available unfortunately. |
boolean |
canGetOwner()
Always returns false, this information is not available unfortunately. |
boolean |
canRunProcess()
Always returns false. |
boolean |
changeDate(long lastModified)
Always returns false (date cannot be changed). |
boolean |
changePermission(int access,
int permission,
boolean enabled)
Changes the specified permission bit. |
void |
delete()
Deletes this file and this file only (does not recurse on folders). |
boolean |
exists()
Returns true if this file exists. |
PermissionBits |
getChangeablePermissions()
Returns a bit mask describing the permission bits that can be changed on this file when calling AbstractFile.changePermission(int, int, boolean) and AbstractFile.changePermissions(int). |
long |
getDate()
Returns this file's last modified date, in milliseconds since the epoch (00:00:00 GMT, January 1, 1970). |
long |
getFreeSpace()
Always returns -1 (not available) |
java.lang.String |
getGroup()
Always returns null, this information is not available unfortunately. |
java.io.InputStream |
getInputStream()
Returns an InputStream to read the contents of this file. |
java.io.OutputStream |
getOutputStream(boolean append)
Returns an OuputStream to write the contents of this file, appending or overwriting the existing
contents. |
java.lang.String |
getOwner()
Always returns null, this information is not available unfortunately. |
AbstractFile |
getParent()
Returns this file's parent, null if it doesn't have one. |
FilePermissions |
getPermissions()
Returns this file's permissions, as a FilePermissions object. |
RandomAccessInputStream |
getRandomAccessInputStream()
Returns a RandomAccessInputStream to read the contents of this file with random access. |
RandomAccessOutputStream |
getRandomAccessOutputStream()
Warning: the returned NFSFile.NFSRandomAccessOutputStream instance
is not fully functional, its NFSFile.NFSRandomAccessOutputStream.setLength(long)
method has a limitation. |
long |
getSize()
Returns this file's size in bytes, 0 if this file doesn't exist, -1 if the size is
undetermined. |
long |
getTotalSpace()
Always returns -1 (not available) |
java.lang.Object |
getUnderlyingFileObject()
Returns a com.sun.xfile.XFile instance corresponding to this file. |
boolean |
hasRandomAccessInputStream()
Returns true: getRandomAccessInputStream() is implemented. |
boolean |
hasRandomAccessOutputStream()
Returns false: getRandomAccessOutputStream() is implemented but the returned
RandomAccessOutputStream is not fully functional. |
boolean |
isDirectory()
Returns true if this file is a directory, false in any of the following cases:
this file does not exist
this file is a regular file
this file is browsable (as reported by AbstractFile.isBrowsable() but not a directory
|
boolean |
isSymlink()
Always returns false (symlinks are not detected). |
AbstractFile[] |
ls()
Returns the children files that this file contains. |
AbstractFile[] |
ls(FilenameFilter filenameFilter)
Returns the children files that this file contains, filtering out files that do not match the specified FilenameFilter. |
void |
mkdir()
Creates this file as a directory. |
boolean |
moveTo(AbstractFile destFile)
Overrides AbstractFile.moveTo(AbstractFile) to move/rename the file directly if the destination file
is also an NFSFile. |
AbstractProcess |
runProcess(java.lang.String[] tokens)
Always throws an IOException. |
void |
setParent(AbstractFile parent)
Sets this file's parent. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SEPARATOR
public static final java.lang.String NFS_VERSION_PROPERTY_NAME
public static final java.lang.String NFS_VERSION_2
public static final java.lang.String NFS_VERSION_3
public static final java.lang.String DEFAULT_NFS_VERSION
public static final java.lang.String NFS_PROTOCOL_PROPERTY_NAME
public static final java.lang.String NFS_PROTOCOL_AUTO
public static final java.lang.String NFS_PROTOCOL_TCP
public static final java.lang.String NFS_PROTOCOL_UDP
public static final java.lang.String DEFAULT_NFS_PROTOCOL
| Constructor Detail |
|---|
public NFSFile(FileURL fileURL)
| Method Detail |
|---|
public long getDate()
AbstractFile
getDate in class AbstractFilepublic boolean canChangeDate()
false (date cannot be changed).
canChangeDate in class AbstractFiletrue if this file's date can be changed using AbstractFile.changeDate(long)public boolean changeDate(long lastModified)
false (date cannot be changed).
changeDate in class AbstractFilelastModified - last modified date, in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
true if date was changed successfully.public long getSize()
AbstractFile0 if this file doesn't exist, -1 if the size is
undetermined.
getSize in class AbstractFilepublic AbstractFile getParent()
AbstractFilenull if it doesn't have one.
getParent in class AbstractFilenull if it doesn't have onepublic void setParent(AbstractFile parent)
AbstractFilenull can be specified if this file doesn't have a parent.
setParent in class AbstractFileparent - the new parent of this filepublic boolean exists()
AbstractFiletrue if this file exists.
exists in class AbstractFiletrue if this file existspublic FilePermissions getPermissions()
AbstractFileFilePermissions object. Note that this file may only support
certain permission bits, use the permission mask to find
out which bits are supported.
This method may return permissions for which none of the bits are supported, but may never return
null.
getPermissions in class AbstractFilepublic PermissionBits getChangeablePermissions()
AbstractFileAbstractFile.changePermission(int, int, boolean) and AbstractFile.changePermissions(int).
getChangeablePermissions in class AbstractFile
public boolean changePermission(int access,
int permission,
boolean enabled)
AbstractFileAbstractFile.getChangeablePermissions()), this method has no effect and false is returned.
changePermission in class AbstractFileaccess - see PermissionTypes for allowed valuespermission - see PermissionAccesses for allowed valuesenabled - true to enable the flag, false to disable it
AbstractFile.getChangeablePermissions()public java.lang.String getOwner()
null, this information is not available unfortunately.
getOwner in class AbstractFilepublic boolean canGetOwner()
false, this information is not available unfortunately.
canGetOwner in class AbstractFilepublic java.lang.String getGroup()
null, this information is not available unfortunately.
getGroup in class AbstractFilepublic boolean canGetGroup()
false, this information is not available unfortunately.
canGetGroup in class AbstractFilepublic boolean isDirectory()
AbstractFiletrue if this file is a directory, false in any of the following cases:
AbstractFile.isBrowsable() but not a directory
isDirectory in class AbstractFiletrue if this file is a directory, false in any of the cases listed abovepublic boolean isSymlink()
false (symlinks are not detected).
isSymlink in class AbstractFiletrue if this file is a symbolic link
public AbstractFile[] ls()
throws java.io.IOException
AbstractFileAbstractFile.isBrowsable() must return true.
This method may return a zero-length array if it has no children but may never return null.
ls in class AbstractFilejava.io.IOException - if this operation is not possible (file is not browsable) or if an error occurred.
public void mkdir()
throws java.io.IOException
AbstractFileIOException) if this file
already exists.
mkdir in class AbstractFilejava.io.IOException - if the directory could not be created, either because this file already exists or for any
other reason.
public java.io.InputStream getInputStream()
throws java.io.IOException
AbstractFileInputStream to read the contents of this file.
Throws an IOException in any of the following cases:
RandomAccessInputStream cannot be provided because the underlying file protocol doesn't have
random access support (see AbstractFile.hasRandomAccessInputStream()null.
getInputStream in class AbstractFileInputStream to read the contents of this file
java.io.IOException - in any of the cases listed above
public java.io.OutputStream getOutputStream(boolean append)
throws java.io.IOException
AbstractFileOuputStream to write the contents of this file, appending or overwriting the existing
contents. This file will be created as a zero-byte file if it does not yet exist.
Throws an IOException in any of the following cases:
append is specified but not supportednull.
getOutputStream in class AbstractFileappend - if true, data written to the OutputStream will be appended to the end of this file. If false,
any existing data this file contains will be discarded and overwritten.
OuputStream to write the contents of this file
java.io.IOException - in any of the cases listed abovepublic boolean hasRandomAccessInputStream()
true: getRandomAccessInputStream() is implemented.
hasRandomAccessInputStream in class AbstractFile
public RandomAccessInputStream getRandomAccessInputStream()
throws java.io.IOException
AbstractFileRandomAccessInputStream to read the contents of this file with random access.
Throws an IOException in any of the following cases:
RandomAccessInputStream cannot be provided because the underlying file protocol doesn't have
random access support (see AbstractFile.hasRandomAccessInputStream()null.
getRandomAccessInputStream in class AbstractFileRandomAccessInputStream to read the contents of this file with random access
java.io.IOException - in any of the cases listed abovepublic boolean hasRandomAccessOutputStream()
false: getRandomAccessOutputStream() is implemented but the returned
RandomAccessOutputStream is not fully functional.
hasRandomAccessOutputStream in class AbstractFile
public RandomAccessOutputStream getRandomAccessOutputStream()
throws java.io.IOException
NFSFile.NFSRandomAccessOutputStream instance
is not fully functional, its NFSFile.NFSRandomAccessOutputStream.setLength(long)
method has a limitation.
getRandomAccessOutputStream in class AbstractFilejava.io.IOException - if the file could not be opened for random write access
public void delete()
throws java.io.IOException
AbstractFileIOException in any of the following cases:
delete in class AbstractFilejava.io.IOException - if this file does not exist or could not be deletedpublic long getFreeSpace()
-1 (not available)
getFreeSpace in class AbstractFile-1 if this information is
not available.public long getTotalSpace()
-1 (not available)
getTotalSpace in class AbstractFilepublic java.lang.Object getUnderlyingFileObject()
com.sun.xfile.XFile instance corresponding to this file.
getUnderlyingFileObject in class AbstractFilenull if there
is nonepublic boolean canRunProcess()
false.
canRunProcess in class AbstractFiletrue if it's possible to run processes on the underlying file system, false otherwise.
public AbstractProcess runProcess(java.lang.String[] tokens)
throws java.io.IOException
IOException.
runProcess in class AbstractFiletokens - command and its arguments for the process to create.
java.io.IOException - thrown if an error occured while creating the process, if the current file is not a directory or if the operation is not supported.
public AbstractFile[] ls(FilenameFilter filenameFilter)
throws java.io.IOException
AbstractFileAbstractFile.isBrowsable() must return
true.
This default implementation filters out files *after* they have been created. This method should be overridden if a more efficient implementation can be provided by subclasses.
ls in class AbstractFilefilenameFilter - the FilenameFilter to be used to filter out files from the list, may be null
java.io.IOException - if this operation is not possible (file is not browsable) or if an error occurred.
public boolean moveTo(AbstractFile destFile)
throws FileTransferException
AbstractFile.moveTo(AbstractFile) to move/rename the file directly if the destination file
is also an NFSFile.
moveTo in class AbstractFiledestFile - the destination file to move this file to
FileTransferException - in any of the cases listed above, use FileTransferException.getReason() to
know the reason.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard