Secure iNet Factory

com.jscape.inet.sftp
Class SftpPacket

java.lang.Object
  extended by com.jscape.inet.sftp.SftpPacket
Direct Known Subclasses:
SshFxpClose, SshFxpFsetstat, SshFxpFstat, SshFxpInit, SshFxpLstat, SshFxpMkdir, SshFxpName, SshFxpOpen, SshFxpOpendir, SshFxpRead, SshFxpReaddir, SshFxpReadlink, SshFxpRealpath, SshFxpRemove, SshFxpRename, SshFxpRmdir, SshFxpSetstat, SshFxpStat, SshFxpStatus, SshFxpSymlink, SshFxpVersion, SshFxpWrite

public abstract class SftpPacket
extends java.lang.Object

Represents SFTP packet. The base class for all SFTP packets.

Author:
Alex Usun

Method Summary
 long getId()
          Returns the current packet number in session.
 int getType()
          Returns packet type code.
static SftpPacket readFrom(java.io.InputStream in, java.lang.Class packetClass, java.lang.String charset)
          Reads the packet from the stream.
static SftpPacket readFrom(SshReader reader, java.lang.Class packetClass)
          Reads the packet from the stream.
 void setId(long id)
          Setups the current packet number in SFTP session.
 void writeTo(java.io.OutputStream out, java.lang.String charset)
          Writes the current packet to the specified stream.
 void writeTo(SshWriter writer)
          Writes the current packet to the specified writer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readFrom

public static SftpPacket readFrom(java.io.InputStream in,
                                  java.lang.Class packetClass,
                                  java.lang.String charset)
                           throws SftpException
Reads the packet from the stream.

Parameters:
in - the input stream
packetClass - the packet class
Returns:
the readed packet
Throws:
SftpException - if an I/O error occurs

readFrom

public static SftpPacket readFrom(SshReader reader,
                                  java.lang.Class packetClass)
                           throws SftpException
Reads the packet from the stream.

Parameters:
reader - the SSH types reader
packetClass - the packet class
Returns:
the readed packet
Throws:
SftpException - if an I/O error occurs

getType

public int getType()
Returns packet type code.

Returns:
packet type code

setId

public void setId(long id)
Setups the current packet number in SFTP session.

Parameters:
id - the current packet number

getId

public long getId()
Returns the current packet number in session.

Returns:
the current packet number in session; null if number is not set.

writeTo

public void writeTo(java.io.OutputStream out,
                    java.lang.String charset)
             throws java.io.IOException
Writes the current packet to the specified stream.

Parameters:
out - the output stream
Throws:
java.io.IOException - if I/O error occured

writeTo

public void writeTo(SshWriter writer)
             throws java.io.IOException
Writes the current packet to the specified writer.

Parameters:
writer - the SSH types writer
Throws:
java.io.IOException - if I/O error occurs

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved