SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class OutgoingFileTransferJabberImpl

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.AbstractFileTransfer
      extended by net.java.sip.communicator.impl.protocol.jabber.OutgoingFileTransferJabberImpl
All Implemented Interfaces:
FileTransfer, org.jivesoftware.smack.PacketInterceptor

public class OutgoingFileTransferJabberImpl
extends AbstractFileTransfer
implements org.jivesoftware.smack.PacketInterceptor

The Jabber protocol extension of the AbstractFileTransfer.

Author:
Yana Stamcheva

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.protocol.FileTransfer
IN, OUT
 
Constructor Summary
OutgoingFileTransferJabberImpl(Contact receiver, File file, org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer jabberTransfer, ProtocolProviderServiceJabberImpl protocolProvider)
          Creates an OutgoingFileTransferJabberImpl by specifying the receiver contact, the file, the jabberTransfer, that would be used to send the file through Jabber and the protocolProvider.
 
Method Summary
 void cancel()
          Cancels the file transfer.
 Contact getContact()
          The contact we are sending the file.
 int getDirection()
          The direction is outgoing.
 String getID()
          The unique id.
 File getLocalFile()
          Returns the local file that is being transferred or to which we transfer.
 long getTransferedBytes()
          Returns the number of bytes already sent to the recipient.
 void interceptPacket(org.jivesoftware.smack.packet.Packet packet)
          Listens for all StreamInitiation packets and adds a thumbnail to them if a thumbnailed file is supported.
 void removeThumbnailRequestListener()
          Removes previously added thumbnail request listener.
 
Methods inherited from class net.java.sip.communicator.service.protocol.AbstractFileTransfer
addProgressListener, addStatusListener, fireProgressChangeEvent, fireStatusChangeEvent, fireStatusChangeEvent, getStatus, removeProgressListener, removeStatusListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutgoingFileTransferJabberImpl

public OutgoingFileTransferJabberImpl(Contact receiver,
                                      File file,
                                      org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer jabberTransfer,
                                      ProtocolProviderServiceJabberImpl protocolProvider)
Creates an OutgoingFileTransferJabberImpl by specifying the receiver contact, the file, the jabberTransfer, that would be used to send the file through Jabber and the protocolProvider.

Parameters:
receiver - the destination contact
file - the file to send
jabberTransfer - the Jabber transfer object, containing all transfer information
protocolProvider - the parent protocol provider
Method Detail

cancel

public void cancel()
Cancels the file transfer.

Specified by:
cancel in interface FileTransfer
Specified by:
cancel in class AbstractFileTransfer

getTransferedBytes

public long getTransferedBytes()
Returns the number of bytes already sent to the recipient.

Specified by:
getTransferedBytes in interface FileTransfer
Specified by:
getTransferedBytes in class AbstractFileTransfer
Returns:
the number of bytes already sent to the recipient.

getDirection

public int getDirection()
The direction is outgoing.

Specified by:
getDirection in interface FileTransfer
Returns:
OUT.

getLocalFile

public File getLocalFile()
Returns the local file that is being transferred or to which we transfer.

Specified by:
getLocalFile in interface FileTransfer
Returns:
the file

getContact

public Contact getContact()
The contact we are sending the file.

Specified by:
getContact in interface FileTransfer
Returns:
the receiver.

getID

public String getID()
The unique id.

Specified by:
getID in interface FileTransfer
Returns:
the id.

removeThumbnailRequestListener

public void removeThumbnailRequestListener()
Removes previously added thumbnail request listener.


interceptPacket

public void interceptPacket(org.jivesoftware.smack.packet.Packet packet)
Listens for all StreamInitiation packets and adds a thumbnail to them if a thumbnailed file is supported.

Specified by:
interceptPacket in interface org.jivesoftware.smack.PacketInterceptor
See Also:
PacketInterceptor.interceptPacket(Packet)

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.