com.mindbright.ssh2
Class SSH2SFTP.FileHandle

java.lang.Object
  extended bycom.mindbright.ssh2.SSH2SFTP.FileHandle
Enclosing class:
SSH2SFTP

public static final class SSH2SFTP.FileHandle
extends java.lang.Object

Describes a file. Client applications should not access the methods in this class directory.

See Also:
SSH2SFTPClient

Field Summary
protected  long lastOffset
          This is used by SSH2SFTPClient to protect against out-of order packets.
 
Constructor Summary
protected SSH2SFTP.FileHandle(java.lang.String name, byte[] handle, boolean isDirectory)
          Construct a new FileHandle with the provided data
 
Method Summary
 void addAsyncListener(SSH2SFTP.AsyncListener listener)
          Register a listener which will be notified when asynchronous operations ends.
protected  void asyncClose()
          Close an asynchronous file.
protected  void asyncEnd(int len)
          An asynchronous operation has completed
protected  void asyncException(SSH2SFTP.SFTPException e)
          Got an asyncronous exception
protected  void asyncReadEOF()
          Got an asyncronous EOF from server.
protected  void asyncStart(int len)
          An asynchronous operation has been started
 boolean asyncWait()
          Wait for all asynchronous operations to complete.
protected  boolean asyncWait(int reqLeft)
          Wait until there is less than a certain number of asynchronous operations outstanding.
protected  byte[] getHandle()
          Get the sftp protocol handle
 java.lang.String getName()
          Get name of underlying file.
 boolean isDirectory()
          Check if thius handle refers to a directory.
 boolean isOpen()
          Check if this handle is open or not
 java.lang.String toString()
          Create a string representation of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lastOffset

protected volatile long lastOffset
This is used by SSH2SFTPClient to protect against out-of order packets.

Constructor Detail

SSH2SFTP.FileHandle

protected SSH2SFTP.FileHandle(java.lang.String name,
                              byte[] handle,
                              boolean isDirectory)
Construct a new FileHandle with the provided data

Parameters:
name - name of file
handle - handle to use in sftp protocol
isDirectory - true if this is a directory
Method Detail

isDirectory

public boolean isDirectory()
Check if thius handle refers to a directory. Client applications should ideally use any of the stat functions in SSH2SFTPClient to get this data.


isOpen

public boolean isOpen()
Check if this handle is open or not


getName

public java.lang.String getName()
Get name of underlying file.


getHandle

protected byte[] getHandle()
Get the sftp protocol handle


addAsyncListener

public void addAsyncListener(SSH2SFTP.AsyncListener listener)
Register a listener which will be notified when asynchronous operations ends. The argument to the progress function will be the number of bytes read.


asyncStart

protected void asyncStart(int len)
An asynchronous operation has been started


asyncEnd

protected void asyncEnd(int len)
An asynchronous operation has completed


asyncReadEOF

protected void asyncReadEOF()
Got an asyncronous EOF from server.


asyncException

protected void asyncException(SSH2SFTP.SFTPException e)
Got an asyncronous exception


asyncClose

protected void asyncClose()
Close an asynchronous file. No asynchronous request may be outstanding.


asyncWait

public boolean asyncWait()
                  throws SSH2SFTP.SFTPException
Wait for all asynchronous operations to complete.

Returns:
true if eof has been received
Throws:
SSH2SFTP.SFTPException

asyncWait

protected boolean asyncWait(int reqLeft)
                     throws SSH2SFTP.SFTPException
Wait until there is less than a certain number of asynchronous operations outstanding.

Returns:
true if eof has been received
Throws:
SSH2SFTP.SFTPException

toString

public java.lang.String toString()
Create a string representation of this object