net.kano.joscar.rvcmd.sendfile
Class FileSendReqRvCmd

java.lang.Object
  extended byRvCommand
      extended byAbstractRvCmd
          extended byAbstractRequestRvCmd
              extended byFileSendReqRvCmd

public class FileSendReqRvCmd
extends AbstractRequestRvCmd

A rendezvous command used to attempt to send one or more files to another user.


Field Summary
 
Fields inherited from class AbstractRequestRvCmd
FPRESENT_DEFAULT, REQTYPE_INITIALREQUEST, REQTYPE_REDIRECT
 
Fields inherited from class RvCommand
RVSTATUS_ACCEPT, RVSTATUS_DENY, RVSTATUS_REQUEST
 
Constructor Summary
FileSendReqRvCmd(int requestType, InvitationMessage message, RvConnectionInfo connInfo, FileSendBlock fileInfo)
          Creates a new outgoing file send request command with the given properties.
FileSendReqRvCmd(InvitationMessage message, RvConnectionInfo connInfo, FileSendBlock fileInfo)
          Creates a new outgoing initial file send request with the given message, connection information, and file transfer information block.
FileSendReqRvCmd(RecvRvIcbm icbm)
          Creates a new file send request from the given incoming file send request RV ICBM.
FileSendReqRvCmd(RvConnectionInfo connInfo)
          Creates a new outgoing file send connection redirection command with the given connection information.
 
Method Summary
 RvConnectionInfo getConnInfo()
          Returns the connection information block sent in this request.
 FileSendBlock getFileSendBlock()
          Returns an object containing information about the file or files being sent, or null if no such information was sent.
 InvitationMessage getMessage()
          Returns the invitation message sent in this command, or null if none was sent.
protected  boolean hasServiceData()
          Returns whether this RV command's TLV list should contain a "service data block" TLV.
 java.lang.String toString()
           
 void writeRvTlvs(java.io.OutputStream out)
          Writes this RV command's list of rendezvous TLV's to the given stream.
protected  void writeServiceData(java.io.OutputStream out)
          Writes this RV command's "service data block."
 
Methods inherited from class AbstractRequestRvCmd
getRequestType, isFPresent, writeHeaderRvTlvs
 
Methods inherited from class AbstractRvCmd
getRvTlvs, getServiceData, writeRvData
 
Methods inherited from class RvCommand
getCapabilityBlock, getRvStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileSendReqRvCmd

public FileSendReqRvCmd(RecvRvIcbm icbm)
Creates a new file send request from the given incoming file send request RV ICBM.

Parameters:
icbm - an incoming file send request RV ICBM

FileSendReqRvCmd

public FileSendReqRvCmd(InvitationMessage message,
                        RvConnectionInfo connInfo,
                        FileSendBlock fileInfo)
Creates a new outgoing initial file send request with the given message, connection information, and file transfer information block. As an initial request, the created request's request type will be AbstractRequestRvCmd.REQTYPE_INITIALREQUEST.

Using this constructor is equivalent to using new FileSendReqRvCmd(REQTYPE_INITIALREQUEST, message, connInfo, file).

Parameters:
message - an "invitation message," a message displayed to the user upon receiving this request, or null to not include an invitation message
connInfo - a connection information block describing the connection to be made, or null to not specify connection information
fileInfo - an object describing the file or files being sent

FileSendReqRvCmd

public FileSendReqRvCmd(RvConnectionInfo connInfo)
Creates a new outgoing file send connection redirection command with the given connection information.

Using this constructor is equivalent to using new FileSendReqRvCmd(REQTYPE_REDIRECT, null, connInfo, null).

Parameters:
connInfo - a block of connection information describing the connection to which a file send connection has been redirected

FileSendReqRvCmd

public FileSendReqRvCmd(int requestType,
                        InvitationMessage message,
                        RvConnectionInfo connInfo,
                        FileSendBlock fileInfo)
Creates a new outgoing file send request command with the given properties.

Parameters:
requestType - a request type, like AbstractRequestRvCmd.REQTYPE_INITIALREQUEST
message - an "invitation message," a message displayed to the user upon receiving this request, or null to not include an invitation message
connInfo - a connection information block describing the connection to be made, or null to not specify connection information
fileInfo - an object describing the file or files being sent
Method Detail

getMessage

public final InvitationMessage getMessage()
Returns the invitation message sent in this command, or null if none was sent.

Returns:
this request's "invitation message"

getConnInfo

public final RvConnectionInfo getConnInfo()
Returns the connection information block sent in this request.

Returns:
the connection information block sent in this request

getFileSendBlock

public final FileSendBlock getFileSendBlock()
Returns an object containing information about the file or files being sent, or null if no such information was sent.

Returns:
an object containing information about the file or files being transferred

writeRvTlvs

public void writeRvTlvs(java.io.OutputStream out)
                 throws java.io.IOException
Description copied from class: AbstractRvCmd
Writes this RV command's list of rendezvous TLV's to the given stream.

Specified by:
writeRvTlvs in class AbstractRvCmd
Parameters:
out - the stream to which to write
Throws:
java.io.IOException - if an I/O error occurs

hasServiceData

protected boolean hasServiceData()
Description copied from class: AbstractRvCmd
Returns whether this RV command's TLV list should contain a "service data block" TLV. The return value of this method must be consistent throughout this object's existence. Note that if this method returns false for an object, writeServiceData will never be called on that object. The default implementation of this method returns true.

Overrides:
hasServiceData in class AbstractRvCmd
Returns:
whether or not this RV command has a "service data block"
See Also:
AbstractRvCmd.writeServiceData(java.io.OutputStream)

writeServiceData

protected void writeServiceData(java.io.OutputStream out)
                         throws java.io.IOException
Description copied from class: AbstractRvCmd
Writes this RV command's "service data block." A service data block's format changes from rendezvous to rendezvous, but generally provides information specific to the type of rendezvous being sent. For example, in a file transfer request, the file's name and size (among other fields) are sent in the service block. This method will never be called if AbstractRvCmd.hasServiceData() returns false. The default implementation of this method does not write any data to the stream.

Overrides:
writeServiceData in class AbstractRvCmd
Parameters:
out - the stream to which to write
Throws:
java.io.IOException - if an I/O error occurs

toString

public java.lang.String toString()