|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindbright.ssh2.SSH2SFTP
com.mindbright.ssh2.SSH2SFTPClient
Implements the client side of the sftp protocol. File reads and writes can be either synchronous (blocking) or asynchronous (non-blocking).
Nested Class Summary |
Nested classes inherited from class com.mindbright.ssh2.SSH2SFTP |
SSH2SFTP.AsyncListener, SSH2SFTP.FileAttributes, SSH2SFTP.FileHandle, SSH2SFTP.SFTPAsyncAbortException, SSH2SFTP.SFTPDisconnectException, SSH2SFTP.SFTPEOFException, SSH2SFTP.SFTPException, SSH2SFTP.SFTPNoSuchFileException, SSH2SFTP.SFTPPacket, SSH2SFTP.SFTPPermissionDeniedException |
Field Summary |
Constructor Summary | |
SSH2SFTPClient(SSH2Connection connection,
boolean isBlocking)
|
Method Summary | |
void |
close(SSH2SFTP.FileHandle handle)
Close a file. |
void |
fsetstat(SSH2SFTP.FileHandle handle,
SSH2SFTP.FileAttributes attrs)
Set attributes on an open file. |
SSH2SFTP.FileAttributes |
fstat(SSH2SFTP.FileHandle handle)
Get attributes of an open file on the server. |
SSH2SFTP.FileAttributes |
lstat(java.lang.String name)
Get attributes of a file on the server. |
void |
mkdir(java.lang.String name,
SSH2SFTP.FileAttributes attrs)
Create a new directory on the server. |
SSH2SFTP.FileHandle |
open(java.lang.String name,
int flags,
SSH2SFTP.FileAttributes attrs)
Open a file on the server. |
SSH2SFTP.FileHandle |
opendir(java.lang.String path)
Opens a directory on the server. |
int |
read(SSH2SFTP.FileHandle handle,
long fileOffset,
byte[] buf,
int off,
int len)
Read data from an open file on the server and stores it in a local buffer. |
int |
read(SSH2SFTP.FileHandle handle,
long fileOffset,
java.io.RandomAccessFile fileTarget,
int len)
Read data from an open file on the server and stores it in a local file. |
SSH2SFTP.FileAttributes[] |
readdir(SSH2SFTP.FileHandle handle)
Gets a list of files, and other objects, in an open directory. |
int |
readFully(SSH2SFTP.FileHandle handle,
java.io.OutputStream out)
Read the entire file on the server and store in a local stream. |
SSH2SFTP.FileAttributes |
realpath(java.lang.String nameIn)
Canonalize a given path. |
void |
remove(java.lang.String name)
Remove a file from the server. |
void |
rename(java.lang.String oldName,
java.lang.String newName)
Rename a file on the server. |
void |
restart()
Reopens the connection to the server. |
void |
rmdir(java.lang.String name)
Removes a directory from the server |
void |
setstat(java.lang.String name,
SSH2SFTP.FileAttributes attrs)
Set attributes on a file. |
SSH2SFTP.FileAttributes |
stat(java.lang.String name)
Get attributes of a file on the server. |
void |
terminate()
Terminate the connection and abort any asynchronous calls which are in progress. |
void |
write(SSH2SFTP.FileHandle handle,
long fileOffset,
byte[] buf,
int off,
int len)
Write data to a remote file. |
int |
writeFully(SSH2SFTP.FileHandle handle,
java.io.InputStream in)
Write an entire stream to a file on the server. |
protected void |
writeInternal(SSH2SFTP.FileHandle handle,
SSH2SFTP.SFTPPacket pkt,
int len)
Internal write function. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SSH2SFTPClient(SSH2Connection connection, boolean isBlocking) throws SSH2SFTP.SFTPException
connection
- Connection to run over.isBlocking
- True if read and write should be asynchronous.Method Detail |
public void terminate()
public void restart() throws SSH2SFTP.SFTPException
SSH2SFTP.SFTPException
public SSH2SFTP.FileHandle open(java.lang.String name, int flags, SSH2SFTP.FileAttributes attrs) throws SSH2SFTP.SFTPException
name
- Name of fileflags
- Mode to open file with. Valid values are
SSH2SFTP.SSH_FXF_*
.attrs
- File attributes for new files.
SSH2SFTP.SFTPException
public void close(SSH2SFTP.FileHandle handle) throws SSH2SFTP.SFTPException
handle
- Handle identifying file.
SSH2SFTP.SFTPException
public int read(SSH2SFTP.FileHandle handle, long fileOffset, java.io.RandomAccessFile fileTarget, int len) throws SSH2SFTP.SFTPException, java.io.IOException
handle
- Handle identifying file.fileOffset
- Where in the file to start to read.fileTarget
- Local file to write the data into.len
- Number of bytes to read.
SSH2SFTP.SFTPException
java.io.IOException
public int read(SSH2SFTP.FileHandle handle, long fileOffset, byte[] buf, int off, int len) throws SSH2SFTP.SFTPException
handle
- Handle identifying file.fileOffset
- Where in the file to start to read.buf
- Local buffer to store data in. Must hold
len
bytes at the given offset.off
- Offset in buffer to store data at.len
- Number of bytes to read.
SSH2SFTP.SFTPException
public int readFully(SSH2SFTP.FileHandle handle, java.io.OutputStream out) throws SSH2SFTP.SFTPException, java.io.IOException
handle
- Handle identifying file.out
- Stream to store data in.
SSH2SFTP.SFTPException
java.io.IOException
protected void writeInternal(SSH2SFTP.FileHandle handle, SSH2SFTP.SFTPPacket pkt, int len) throws SSH2SFTP.SFTPException
SSH2SFTP.SFTPException
public void write(SSH2SFTP.FileHandle handle, long fileOffset, byte[] buf, int off, int len) throws SSH2SFTP.SFTPException
handle
- Handle identifying file.fileOffset
- Offset to store data at.buf
- Buffer containing data to write.off
- Offset in buf
to read data at.len
- Number of bytes to write.
SSH2SFTP.SFTPException
public int writeFully(SSH2SFTP.FileHandle handle, java.io.InputStream in) throws SSH2SFTP.SFTPException, java.io.IOException
handle
- Handle identifying file.in
- Stream to read data to write from.
SSH2SFTP.SFTPException
java.io.IOException
public SSH2SFTP.FileAttributes lstat(java.lang.String name) throws SSH2SFTP.SFTPException
name
- Name of file to get attributes of.
SSH2SFTP.SFTPException
public SSH2SFTP.FileAttributes stat(java.lang.String name) throws SSH2SFTP.SFTPException
name
- Name of file to get attributes of.
SSH2SFTP.SFTPException
public SSH2SFTP.FileAttributes fstat(SSH2SFTP.FileHandle handle) throws SSH2SFTP.SFTPException
handle
- Handle identifying file.
SSH2SFTP.SFTPException
public void setstat(java.lang.String name, SSH2SFTP.FileAttributes attrs) throws SSH2SFTP.SFTPException
name
- Name of file to set attributes on.attrs
- Attributes to set.
SSH2SFTP.SFTPException
public void fsetstat(SSH2SFTP.FileHandle handle, SSH2SFTP.FileAttributes attrs) throws SSH2SFTP.SFTPException
handle
- Handle identifying the file.attrs
- Attributes to set.
SSH2SFTP.SFTPException
public SSH2SFTP.FileHandle opendir(java.lang.String path) throws SSH2SFTP.SFTPException
path
- name of directory to open
SSH2SFTP.SFTPException
public SSH2SFTP.FileAttributes[] readdir(SSH2SFTP.FileHandle handle) throws SSH2SFTP.SFTPException
opendir
.
handle
- Hande identifying the remote directory.
SSH2SFTP.SFTPException
public void remove(java.lang.String name) throws SSH2SFTP.SFTPException
name
- Name of file to remove.
SSH2SFTP.SFTPException
public void rename(java.lang.String oldName, java.lang.String newName) throws SSH2SFTP.SFTPException
oldName
- current name of file to rename.newName
- desired new name of file.
SSH2SFTP.SFTPException
public void mkdir(java.lang.String name, SSH2SFTP.FileAttributes attrs) throws SSH2SFTP.SFTPException
name
- name of directory to create.attrs
- Attributes to apply to the new directory.
SSH2SFTP.SFTPException
public void rmdir(java.lang.String name) throws SSH2SFTP.SFTPException
name
- Name of directory to remove.
SSH2SFTP.SFTPException
public SSH2SFTP.FileAttributes realpath(java.lang.String nameIn) throws SSH2SFTP.SFTPException
..
'.
nameIn
- Path to canonalize.
FileAttributes
object with the name and
lname fields filled in.
SSH2SFTP.SFTPException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |