com.mindbright.ssh2
Class SSH2SFTP.SFTPPacket

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

protected static final class SSH2SFTP.SFTPPacket
extends SSH2DataBuffer

Handles sftp data packets. Contains functions to read and write the sftp types.


Field Summary
 
Fields inherited from class com.mindbright.ssh2.SSH2DataBuffer
BOOLEAN_FALSE, BOOLEAN_TRUE, data, rPos, wPos
 
Constructor Summary
SSH2SFTP.SFTPPacket()
           
 
Method Summary
 void failsafeReadFrom(java.io.InputStream in)
          Failsafe read method.
 int getId()
           
 int getLength()
           
 int getType()
           
 SSH2SFTP.FileAttributes readAttrs()
           
 void readFrom(java.io.InputStream in)
           
 long readLong()
           
 void reset(int type, int id)
           
 void writeAttrs(SSH2SFTP.FileAttributes attrs)
           
 void writeLong(long l)
           
 void writeTo(java.io.OutputStream out)
           
 
Methods inherited from class com.mindbright.ssh2.SSH2DataBuffer
getData, getMaxReadSize, getMaxWriteSize, getRPos, getWPos, readBigInt, readBigIntBits, readBoolean, readByte, readInt, readJavaString, readRaw, readRaw, readRestRaw, readString, readString, reset, setData, setRPos, setWPos, writeBigInt, writeBigIntBits, writeBoolean, writeByte, writeInt, writeRaw, writeRaw, writeString, writeString, writeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSH2SFTP.SFTPPacket

public SSH2SFTP.SFTPPacket()
Method Detail

reset

public void reset(int type,
                  int id)

getType

public int getType()

getId

public int getId()

getLength

public int getLength()

writeLong

public void writeLong(long l)

readLong

public long readLong()

writeAttrs

public void writeAttrs(SSH2SFTP.FileAttributes attrs)

readAttrs

public SSH2SFTP.FileAttributes readAttrs()

failsafeReadFrom

public void failsafeReadFrom(java.io.InputStream in)
                      throws SSH2SFTP.SFTPException
Failsafe read method. Tries to read a packet from the given stream. but does ignore stuff which does not look like a packet. The algorithm is that a probable packet starts with two bytes containing zeros.

This is useful when reading the first version packet which is small but may be, on broken systems, preceded by some ascii characters.

Parameters:
in - Stream to read data from
Throws:
SSH2SFTP.SFTPException

readFrom

public void readFrom(java.io.InputStream in)
              throws SSH2SFTP.SFTPException
Throws:
SSH2SFTP.SFTPException

writeTo

public void writeTo(java.io.OutputStream out)
             throws SSH2SFTP.SFTPException
Throws:
SSH2SFTP.SFTPException