|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sshtools.j2ssh.transport.SshMessage
This abstract class should be subclassed to provide message implementations
for the SSH2 protocol. The message object can be constructed either from a
byte array or implementation specific types. The transport layer dynamically
creates the class from the registered message details and calls
fromByteArray
to populate before routing the message to the
registered message store.
Constructor Summary | |
SshMessage(int messageId)
Constructs an SshMessage used to send. |
Method Summary | |
protected abstract void |
constructByteArray(ByteArrayWriter baw)
Abstract method which is called to construct the byte array returned in a call to toByteArray. |
protected abstract void |
constructMessage(ByteArrayReader bar)
Abstract method which is called to construct the message from a byte array. |
protected void |
fromByteArray(ByteArrayReader data)
Constructs an SshMessage from a byte array. |
int |
getMessageId()
|
abstract java.lang.String |
getMessageName()
Gets the messageName attribute of the SshMessage object |
byte[] |
toByteArray()
Converts the message into a byte array suitable for sending. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SshMessage(int messageId)
Constructs an SshMessage used to send. Subclasses classes will set their own properties typically passed to its own constructor.
messageId
- The message Id of the message.Method Detail |
protected final void fromByteArray(ByteArrayReader data) throws InvalidMessageException
Constructs an SshMessage from a byte array. This method calls the abstract method constructMessage to allow subclasses classes to perform message specific construction.
data
- The data being read.
InvalidMessageException
- Thrown when the data cannot be read.public final int getMessageId()
public abstract java.lang.String getMessageName()
public final byte[] toByteArray() throws InvalidMessageException
Converts the message into a byte array suitable for sending.
InvalidMessageException
- Thrown when the byte array cannot be
written.protected abstract void constructByteArray(ByteArrayWriter baw) throws InvalidMessageException
Abstract method which is called to construct the byte array returned in a call to toByteArray.
baw
- The ByteArrayWriter instance
constructing the array.
InvalidMessageException
- Thrown when the array cannot be
written.protected abstract void constructMessage(ByteArrayReader bar) throws InvalidMessageException
Abstract method which is called to construct the message from a byte array.
bar
- The ByteArrayReader containing the
message data.
InvalidMessageException
- Thrown when the message cannot be
constructed either because the data supplied is corrupt or there are
insufficient bytes.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |