public class SftpFile extends Object
| Constructor and Description |
|---|
SftpFile(String path,
SftpFileAttributes attrs)
Deprecated.
Use constructor that requires a flag for whether paths are processed or not (checked for / at the end and removed).
|
SftpFile(String path,
SftpFileAttributes attrs,
boolean processPath)
Creates a new SftpFile object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead()
Determine whether the user has read access to the file.
|
boolean |
canWrite()
Determine whether the user has write access to the file.
|
void |
close()
Close the file.
|
void |
delete()
Delete this file/directory from the remote server.
|
boolean |
equals(Object obj)
Compares the Object to this instance and returns true if they point to the
same file.
|
String |
getAbsolutePath()
Get the absolute path
|
SftpFileAttributes |
getAttributes()
Get the files attributes.
|
String |
getFilename()
Get the filename.
|
byte[] |
getHandle()
Get the open file handle
|
String |
getLongname()
The longname supplied by the server.
|
SftpFile |
getParent()
Get the parent of the current file.
|
SftpSubsystemChannel |
getSFTPChannel()
Get the SFTP subsystem channel that created this file object.
|
int |
hashCode() |
boolean |
isBlock()
Determine whether the file is pointing to a block special file.
|
boolean |
isCharacter()
Determine whether the file is pointing to a character mode device.
|
boolean |
isDirectory()
Determine whether the file object is pointing to a directory.
|
boolean |
isFifo()
Determine whether the file is pointing to a pipe.
|
boolean |
isFile()
Determine whether the file object is pointing to a file.
|
boolean |
isLink()
Determine whether the file object is a symbolic link.
|
boolean |
isOpen()
Determine whether the file is open.
|
boolean |
isSocket()
Determine whether the file is pointing to a socket.
|
void |
setHandle(byte[] handle)
Set the open file handle
|
void |
setSFTPSubsystem(SftpSubsystemChannel sftp)
Sets the SFTP subsystem
|
String |
toString() |
public SftpFile(String path, SftpFileAttributes attrs)
path - attrs - public SftpFile(String path, SftpFileAttributes attrs, boolean processPath)
path - attrs - processPath - public SftpFile getParent() throws SshException, SftpStatusException
SshExceptionSftpStatusExceptionpublic String getLongname()
public boolean equals(Object obj)
public void delete()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic boolean canWrite()
throws SftpStatusException,
SshException
SftpStatusExceptionSshExceptionpublic boolean canRead()
throws SftpStatusException,
SshException
SftpStatusExceptionSshExceptionpublic boolean isOpen()
public void setHandle(byte[] handle)
handle - public byte[] getHandle()
public void setSFTPSubsystem(SftpSubsystemChannel sftp)
sftp - public SftpSubsystemChannel getSFTPChannel()
public String getFilename()
public SftpFileAttributes getAttributes() throws SftpStatusException, SshException
SshExceptionSftpStatusExceptionpublic String getAbsolutePath()
public void close()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic boolean isDirectory()
throws SftpStatusException,
SshException
false
will be returned. Use SftpClient.isDirectoryOrLinkedDirectory(SftpFile) instead if you
wish to follow links.SshExceptionSftpStatusExceptionpublic boolean isFile()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic boolean isLink()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic boolean isFifo()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic boolean isBlock()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic boolean isCharacter()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic boolean isSocket()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionCopyright © 2025. All rights reserved.