|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.inet.sftp.SftpFile
public class SftpFile
The SFTP file. This abstraction hides the implementation details, such as protocol commands etc., and provides full access to the remote file through the common interface.
Constructor Summary | |
---|---|
SftpFile(SftpFile parent,
java.lang.String child,
SftpClient client)
Creates a new SFTP file instance from a parent abstract pathname and a child pathname string. |
|
SftpFile(java.lang.String path,
SftpClient client)
Creates a new SFTP file instance by converting the given path string into an abstract path. |
Method Summary | |
---|---|
void |
createNewDirectory()
Creates the directory named by this abstract pathname if and only if a file with this name does not yet exist. |
void |
createNewFile()
Creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. |
void |
createNewLink(JFile target)
Creates the symbolic link named by this abstract pathname if and only if a file with this name does not yet exist. |
void |
delete()
Deletes the file or directory denoted by this abstract pathname. |
void |
deleteRecursive()
Recursively deletes the file or directory denoted by this abstract pathname. |
boolean |
exists()
Tests whether the file denoted by this abstract pathname exists. |
long |
getAccessTime()
Returns the file access time as seconds from Jan 1, 1970 in UTC. |
long |
getAccessTimeNsec()
Returns the additional file access time nano-seconds. |
JAcl[] |
getAcl()
Obtains the file ACL array similar to that defined in section 5.9 of NFS version 4 Protocol |
long |
getCreationTime()
Returns the file creation time as seconds from Jan 1, 1970 in UTC. |
long |
getCreationTimeNsec()
Returns the additional file creation time nano-seconds. |
java.util.Date |
getDate()
Returns the file modification date as Data object. |
java.lang.String |
getFilename()
Returns the name of the file or directory denoted by this abstract pathname. |
long |
getFilesize()
Returns the size of the file denoted by this abstract pathname. |
JFileSystem |
getFileSystem()
Returns the underlayed file system object. |
java.lang.String |
getGroup()
Returns the owner group name for this abstract pathname as string. |
JFile |
getLinkTarget()
Returns the link target if the current file is symbolic link. |
long |
getModificationTime()
Returns the file modification time as seconds from Jan 1, 1970 in UTC. |
long |
getModificationTimeNsec()
Returns the additional file modification time nano-seconds. |
java.lang.String |
getOwner()
Returns the owner name for this abstract pathname as string. |
JFile |
getParentFile()
Returns the abstract pathname of this abstract pathname's parent. |
java.lang.String |
getPath()
Converts this abstract pathname into a pathname string. |
java.lang.String |
getPermission()
Returns POSIX string representation of the file permissions. |
JFilePermissions |
getPermissions()
Returns the POSIX file permissions for this abstract pathname. |
JRandomAccessFile |
getRandomAccessFile(JFileOpenFlags openFlags,
JAcl.Mask accessType)
Provides access to the file contents returning a new JRandomAccessFile instance. |
java.lang.String |
getTime()
Returns the file modification time as String . |
JFileType |
getType()
Returns the POSIX file type represented by this abstract pathname. |
boolean |
isAppendOnly()
Tests whether the file named by this abstract pathname can only be opened for writing in append mode. |
boolean |
isArchive()
Tests whether the file named by this abstract pathname should be included in backup / archive operations. |
boolean |
isCaseInsensitive()
This attribute can only apply to directories. |
boolean |
isCompressed()
Tests whether the file named by this abstract pathname is compressed. |
boolean |
isDirectory()
Tests whether the file denoted by this abstract pathname is a directory. |
boolean |
isEncrypted()
Tests whether the file named by this abstract pathname is encrypted. |
boolean |
isHidden()
Tests whether the file named by this abstract pathname is a hidden file. |
boolean |
isImmutable()
Tests whether the file named by this abstract pathname cannot be deleted or renamed, no hard link can be created to this file and no data can be written to the file. |
boolean |
isReadOnly()
Tests whether the file named by this abstract pathname is not writable. |
boolean |
isSparse()
Tests whether the file named by this abstract pathname is sparse. |
boolean |
isSync()
Tests whether the file named by this abstract pathname when is modified, the changes are written synchronously to the disk. |
boolean |
isSystem()
Tests whether the file named by this abstract pathname is part of operating system. |
JFile[] |
listFiles()
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname. |
JFile[] |
listFiles(JFileFilter filter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. |
void |
renameTo(JFile dest)
Renames the file denoted by this abstract pathname. |
void |
setAcl(JAcl[] acls)
Setups the file ACL's. |
void |
setArchive(boolean archive)
Setups archive attribute for this file. |
void |
setGroup(java.lang.String gid)
Setups the new file owner group ID. |
void |
setImmutable(boolean immutable)
Setups file immutability. |
void |
setOwner(java.lang.String uid)
Setups the new file user ID. |
void |
setPermissions(JFilePermissions permissions)
Setups the new file permissions. |
void |
setSync(boolean sync)
Setups file changes synchronization mode. |
java.lang.String |
toString()
Obtains the current file string representation in for as Unix "ls -l" command does, i.e.: "-rw-rw-rw- owner group 23412 Oct 10 2004 10:20 somefile.txt" |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SftpFile(java.lang.String path, SftpClient client)
path
- a path stringclient
- the underlayed SFTP clientpublic SftpFile(SftpFile parent, java.lang.String child, SftpClient client)
parent
- the parent abstract pathnamechild
- the child pathname stringclient
- the underlayed SFTP clientMethod Detail |
---|
public java.lang.String getFilename()
getFilename
in interface JFile
public java.lang.String getPath()
getPath
in interface JFile
public JFile getParentFile()
getParentFile
in interface JFile
public JFileType getType() throws SftpException
getType
in interface JFile
SftpException
- if an I/O error occuredpublic boolean isDirectory() throws SftpException
isDirectory
in interface JFile
true
if and only if the file denoted by this
abstract pathname exists and is a directory; false
otherwise
SftpException
- if an I/O error occuredpublic long getFilesize() throws SftpException
getFilesize
in interface JFile
SftpException
- if an I/O error occuredpublic java.lang.String getOwner() throws SftpException
getOwner
in interface JFile
SftpException
- if an I/O error occuredpublic void setOwner(java.lang.String uid) throws SftpException
setOwner
in interface JFile
uid
- the new file user ID
SftpException
- if an I/O error occuredpublic java.lang.String getGroup() throws SftpException
getGroup
in interface JFile
SftpException
- if an I/O error occuredpublic void setGroup(java.lang.String gid) throws SftpException
setGroup
in interface JFile
gid
- the new file owner group ID
SftpException
- if an I/O error occuredpublic JFilePermissions getPermissions() throws SftpException
getPermissions
in interface JFile
SftpException
- if an I/O error occuredpublic java.lang.String getPermission() throws SftpException
SftpException
- if an I/O error occuredpublic void setPermissions(JFilePermissions permissions) throws SftpException
setPermissions
in interface JFile
permissions
- the new file permissions
SftpException
- if an I/O error occuredpublic long getAccessTime() throws SftpException
getAccessTime
in interface JFile
SftpException
- if an I/O error occuredpublic long getAccessTimeNsec() throws SftpException
getAccessTimeNsec
in interface JFile
SftpException
- if an I/O error occuredpublic long getCreationTime() throws SftpException
getCreationTime
in interface JFile
SftpException
- if an I/O error occuredpublic long getCreationTimeNsec() throws SftpException
getCreationTimeNsec
in interface JFile
SftpException
public long getModificationTime() throws SftpException
getModificationTime
in interface JFile
SftpException
- if an I/O error occuredpublic long getModificationTimeNsec() throws SftpException
getModificationTimeNsec
in interface JFile
SftpException
public java.util.Date getDate() throws SftpException
Data
object.
Legacy code from the FtpFile.
SftpException
- if an I/O error occuredpublic java.lang.String getTime() throws SftpException
String
.
Legacy method from the FtpFile.
String
SftpException
- if an I/O error occuredpublic JAcl[] getAcl() throws SftpException
getAcl
in interface JFile
SftpException
- if an I/O error occuredpublic void setAcl(JAcl[] acls) throws SftpException
setAcl
in interface JFile
acls
- the new file ACL's
SftpException
- if an I/O error occuredpublic boolean isReadOnly() throws SftpException
isReadOnly
in interface JFile
true
if and only if the file denoted by this
abstract pathname is not writable;
false otherwise
- Throws:
SftpException
- if an I/O error occured
public boolean isSystem() throws SftpException
isSystem
in interface JFile
true
if and only if the file denoted by this
abstract pathname is part of operation system;
false otherwise
- Throws:
SftpException
- if an I/O error occured
public boolean isHidden() throws SftpException
isHidden
in interface JFile
true
if and only if the file denoted by this
abstract pathname is hidden according to the conventions
of the underlying platform; false otherwise
- Throws:
SftpException
- if an I/O error occured
public boolean isCaseInsensitive() throws SftpException
isCaseInsensitive
in interface JFile
true
if and only if files and directory names
in this directory should be compared without regard to case;
false otherwise
- Throws:
SftpException
- if an I/O error occured
public boolean isArchive() throws SftpException
isArchive
in interface JFile
true
if and only if the file denoted by this
abstract pathname should be included in backup / archive operations;
false otherwise
- Throws:
SftpException
- if an I/O error occured
public void setArchive(boolean archive) throws SftpException
setArchive
in interface JFile
archive
- if true
the file denoted by this
abstract pathname should be included in backup / archive operations
SftpException
- if an I/O error occuredpublic boolean isEncrypted() throws SftpException
isEncrypted
in interface JFile
true
if and only if the file denoted by this
abstract pathname is encrypted; false otherwise
- Throws:
SftpException
- if an I/O error occured
public boolean isCompressed() throws SftpException
isCompressed
in interface JFile
true
if and only if the file denoted by this
abstract pathname is compressed; false otherwise
- Throws:
SftpException
- if an I/O error occured
public boolean isSparse() throws SftpException
isSparse
in interface JFile
true
if and only if the file denoted by this
abstract pathname is sparse; false otherwise
- Throws:
SftpException
- if an I/O error occured
public boolean isAppendOnly() throws SftpException
isAppendOnly
in interface JFile
true
if and only if the file denoted by this
abstract pathname can only be opened for writing in append mode;
false otherwise
- Throws:
SftpException
- if an I/O error occured
public boolean isImmutable() throws SftpException
isImmutable
in interface JFile
true
if and only if the file denoted by this
abstract pathname is immutable; false otherwise
- Throws:
SftpException
- if an I/O error occured
public void setImmutable(boolean immutable) throws SftpException
setImmutable
in interface JFile
immutable
- if true
the file becames immutable
SftpException
- if an I/O error occuredpublic boolean isSync() throws SftpException
isSync
in interface JFile
true
if and only if the file denoted by this
abstract pathname is sync; false otherwise
- Throws:
SftpException
- if an I/O error occured
public void setSync(boolean sync) throws SftpException
setSync
in interface JFile
sync
- if true
the changes to this file must be written
synchronously to the disk
SftpException
- if an I/O error occuredpublic boolean exists() throws SftpException
exists
in interface JFile
true
if and only if the file denoted by
this abstract pathname exists; false
otherwise
SftpException
public void createNewFile() throws SftpException
createNewFile
in interface JFile
SftpException
- if an I/O error occurredpublic void createNewDirectory() throws SftpException
createNewDirectory
in interface JFile
SftpException
- if an I/O error occurredpublic void createNewLink(JFile target) throws SftpException
createNewLink
in interface JFile
target
- target file for the link
SftpException
- if an I/O error occurredpublic void renameTo(JFile dest) throws SftpException
renameTo
in interface JFile
dest
- the new abstract pathname for the named file
SftpException
- if an I/O error occurredpublic void delete() throws SftpException
delete
in interface JFile
SftpException
- if an I/O error occurredpublic void deleteRecursive() throws SftpException
deleteRecursive
in interface JFile
SftpException
- if an I/O error occurredpublic JFile[] listFiles() throws SftpException
listFiles
in interface JFile
SftpException
- if an I/O error occurredpublic JFile[] listFiles(JFileFilter filter) throws SftpException
listFiles
in interface JFile
filter
- a file filter
SftpException
- if an I/O error occurredpublic JFile getLinkTarget() throws SftpException
getLinkTarget
in interface JFile
SftpException
- if an I/O error occuredpublic JRandomAccessFile getRandomAccessFile(JFileOpenFlags openFlags, JAcl.Mask accessType) throws SftpException
getRandomAccessFile
in interface JFile
openFlags
- the file open flagsaccessType
- desired access type
SftpException
- if an I/O error occurredpublic JFileSystem getFileSystem()
getFileSystem
in interface JFile
public java.lang.String toString()
toString
in class java.lang.Object
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |