public class SftpFile
extends java.lang.Object
| Constructor and Description |
|---|
SftpFile(java.lang.String path,
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
|
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,
SftpFileAttributes attrs)
path - attrs - public SftpFile getParent() throws SshException, SftpStatusException
SshExceptionSftpStatusExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String getLongname()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - public void delete()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic int read(long offset,
byte[] output,
int outputOffset,
int len)
throws SftpStatusException,
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 readSftpStatusExceptionSshExceptionpublic void write(long offset,
byte[] input,
int inputOffset,
int len)
throws SftpStatusException,
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 writeSftpStatusExceptionSshExceptionpublic boolean canWrite()
throws SftpStatusException,
SshException
SftpStatusExceptionSshExceptionpublic boolean canRead()
throws SftpStatusException,
SshException
SftpStatusExceptionSshExceptionpublic boolean isOpen()
public byte[] getHandle()
public SftpChannel getSFTPChannel()
public java.lang.String getFilename()
public SftpFileAttributes getAttributes() throws SftpStatusException, SshException
SshExceptionSftpStatusExceptionpublic java.lang.String getAbsolutePath()
public void close()
throws SftpStatusException,
SshException
SshExceptionSftpStatusExceptionpublic boolean isDirectory()
throws SftpStatusException,
SshException
false
will be returned. Use com.sshtools.sftp.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
SshExceptionSftpStatusExceptionpublic void setProperty(java.lang.String key,
java.lang.Object value)
public java.lang.Object getProperty(java.lang.String key)
Copyright © 2022. All rights reserved.