public class SftpFile
extends java.lang.Object
Constructor and Description |
---|
SftpFile(java.lang.String path,
com.sshtools.common.sftp.SftpFileAttributes attrs)
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(java.lang.Object obj)
Compares the Object to this instance and returns true if they point to the
same file.
|
java.lang.String |
getAbsolutePath()
Get the absolute path
|
com.sshtools.common.sftp.SftpFileAttributes |
getAttributes()
Get the files attributes.
|
java.lang.String |
getFilename()
Get the filename.
|
byte[] |
getHandle()
Get the open file handle
|
java.lang.String |
getLongname()
The longname supplied by the server.
|
SftpFile |
getParent()
Get the parent of the current file.
|
java.lang.Object |
getProperty(java.lang.String key) |
SftpChannel |
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.
|
int |
read(long offset,
byte[] output,
int outputOffset,
int len)
Read bytes directly from this file.
|
void |
setProperty(java.lang.String key,
java.lang.Object value) |
java.lang.String |
toString() |
void |
write(long offset,
byte[] input,
int inputOffset,
int len)
Write bytes directly to this file.
|
public SftpFile(java.lang.String path, com.sshtools.common.sftp.SftpFileAttributes attrs)
path
- attrs
- public SftpFile getParent() throws com.sshtools.common.ssh.SshException, com.sshtools.common.sftp.SftpStatusException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getLongname()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- public void delete() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public int read(long offset, byte[] output, int outputOffset, int len) throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
Read bytes directly from this file. This is a low-level operation,
you may only need to use SftpClientTask.get(String)
methods instead if you just want
to download files.
offset
- offset in remote file to read fromoutput
- output buffer to place read bytes inoutputOffset
- offset in output buffer to write bytes tolen
- number of bytes to readcom.sshtools.common.sftp.SftpStatusException
com.sshtools.common.ssh.SshException
public void write(long offset, byte[] input, int inputOffset, int len) throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
Write bytes directly to this file. This is a low-level operation,
you may only need to use SftpClientTask.put(String)
methods instead if you just want
to upload files.
offset
- offset in remote file to write toinput
- input buffer to retrieve bytes from to writeinputOffset
- offset in output buffer to write bytes tolen
- number of bytes to writecom.sshtools.common.sftp.SftpStatusException
com.sshtools.common.ssh.SshException
public boolean canWrite() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
com.sshtools.common.ssh.SshException
public boolean canRead() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
com.sshtools.common.ssh.SshException
public boolean isOpen()
public byte[] getHandle()
public SftpChannel getSFTPChannel()
public java.lang.String getFilename()
public com.sshtools.common.sftp.SftpFileAttributes getAttributes() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public java.lang.String getAbsolutePath()
public void close() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public boolean isDirectory() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
false
will be returned. Use com.sshtools.sftp.SftpClient#isDirectoryOrLinkedDirectory(SftpFile)
instead if you
wish to follow links.com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public boolean isFile() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public boolean isLink() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public boolean isFifo() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public boolean isBlock() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public boolean isCharacter() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public boolean isSocket() throws com.sshtools.common.sftp.SftpStatusException, com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
com.sshtools.common.sftp.SftpStatusException
public void setProperty(java.lang.String key, java.lang.Object value)
public java.lang.Object getProperty(java.lang.String key)
Copyright © 2023. All rights reserved.