com.skype.api
Class Transfer

java.lang.Object
  extended by com.skype.ipc.SidObject
      extended by com.skype.api.Transfer
All Implemented Interfaces:
SidGetResponding

public final class Transfer
extends SidObject

Transfer in this context refers to transferring (sending/receiving) files among Skype Contacts, not transferring a call to another Skype or PSTN Contact. This class includes file transfer-specific properties and methods, such as FILESIZE, BYTESPERSECOND, Pause and Resume. Recipients of these file transfers must explicitly accept (or decline) any incoming transfer. Transfer instances represent files being sent and received within a Conversation context. Each Transfer instance represents a single file transfer - if a conversation has multiple remote participants, a separate Transfer instance must be instantiated for each remote participant (a Transfer instance is not instantiated for the sender). Transfer instances cannot be instantiated directly. Instead, you initiate a file transfer by invoking Conversation.PostFiles. This instantiates a Message instance of type POSTED_FILES, which is added to the Conversation for all the participants (including the sender). The Transfer instance is associated with this Message instance, and the Message.P_BODY_XML looks like this:


Nested Class Summary
static class Transfer.FailureReason
           
static class Transfer.Property
          Properties of the Transfer class
static class Transfer.Status
          Recognized values for the P_STATUS property.
static class Transfer.Type
           
 
Field Summary
 int mBytesPerSecond
           
 java.lang.String mBytesTransferred
           
 byte[] mChatMsgGuid
           
 int mChatMsgIndex
           
 Conversation mConversation
           
 Transfer.FailureReason mFailureReason
           
 java.lang.String mFileName
           
 java.lang.String mFilePath
           
 java.lang.String mFileSize
           
 int mFinishTime
           
 java.lang.String mPartnerDisplayName
           
 java.lang.String mPartnerHandle
           
 int mStartTime
           
 Transfer.Status mStatus
           
 Transfer.Type mType
           
 
Fields inherited from class com.skype.ipc.SidObject
mSidCached, mSidOid, mSidRoot, mSidTimestamp
 
Constructor Summary
Transfer(int oid, SidRoot root)
           
 
Method Summary
 boolean accept(java.lang.String filenameWithPath)
          Accepts an incoming file transfer and saves it to specified file on the local file system.
 void cancel()
          Cancels an in-progress file transfer.
 int getBytesPerSecond()
          Current data transfer speed in bytes per second.
 java.lang.String getBytesTransferred()
          The number of bytes already transferred.
 byte[] getChatMsgGuid()
          The "global ID" of this Transfer's associated Message instance.
 int getChatMsgIndex()
          A more or less arbitrary index for ordering multiple file transfers within the UI.
 Conversation getConversation()
          The "global ID" of this Transfer's associated Conversation (as chained through its associated Message).
 Transfer.FailureReason getFailureReason()
          Set whenever P_STATUS transitions to FAILED.
 java.lang.String getFileName()
          The filename -only- of the file being transfered.
 java.lang.String getFilePath()
          The path -and- filename of the file being transfered (typically fully qualified).
 java.lang.String getFileSize()
          The size of the file being transferred in bytes.
 int getFinishTime()
          UNIX timestamp of when this Transfer COMPLETED or FAILED.
 java.lang.String getPartnerDisplayName()
          Display name of the remote participant.
 java.lang.String getPartnerHandle()
          Skype Name of the remote party of the file transfer.
 java.lang.String getPropertyAsString(int prop)
           
 java.lang.String getPropertyAsString(Transfer.Property prop)
           
 int getStartTime()
          UNIX timestamp of when this Transfer instance was instantiated, not when the transfer process actually started (was accepted from receiver side).
 Transfer.Status getStatus()
          Current state of the transfer
 Transfer.Type getType()
          INCOMING / OUTGOING
 int moduleId()
           
 void pause()
          Temporarily pauses an in-progress incoming or outgoing file transfer.
 void resume()
          Resumes a previously paused file transfer.
 byte[] sidGetBinaryProperty(PropertyEnumConverting prop)
           
 EnumConverting sidGetEnumProperty(PropertyEnumConverting prop)
           
 int sidGetIntProperty(PropertyEnumConverting prop)
           
 SidObject sidGetObjectProperty(PropertyEnumConverting prop)
           
 java.lang.String sidGetStringProperty(PropertyEnumConverting prop)
           
 SidGetResponding sidMultiGet(Transfer.Property[] requested)
          generic multiget of a list of Property
static SidGetResponding[] sidMultiGet(Transfer.Property[] requested, Transfer[] objects)
          generic multiget of list of Property for a list of Transfer
protected  void sidOnChangedProperty(int propertyId, int value, java.lang.String svalue)
           
 void sidSetProperty(PropertyEnumConverting prop, byte[] newValue)
           
 void sidSetProperty(PropertyEnumConverting prop, int newValue)
           
 void sidSetProperty(PropertyEnumConverting prop, SidObject newValue)
           
 void sidSetProperty(PropertyEnumConverting prop, java.lang.String newValue)
           
 
Methods inherited from class com.skype.ipc.SidObject
finalize, getOid, hasCached, invalidateCache, isCached, sidDoRequest, sidGetBoolProperty, sidGetFilenameProperty, sidGetLongProperty, sidGetObject, sidGetUintProperty, sidGetXmlProperty, sidMultiGet, sidMultiGet, sidMultiGet, sidMultiGet, sidRequestBinaryProperty, sidRequestBoolProperty, sidRequestEnumProperty, sidRequestFilenameProperty, sidRequestIntProperty, sidRequestObjectProperty, sidRequestProperty, sidRequestStringProperty, sidRequestUintProperty, sidRequestXmlProperty, sidSetProperty
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mType

public Transfer.Type mType

mPartnerHandle

public java.lang.String mPartnerHandle

mPartnerDisplayName

public java.lang.String mPartnerDisplayName

mStatus

public Transfer.Status mStatus

mFailureReason

public Transfer.FailureReason mFailureReason

mStartTime

public int mStartTime

mFinishTime

public int mFinishTime

mFilePath

public java.lang.String mFilePath

mFileName

public java.lang.String mFileName

mFileSize

public java.lang.String mFileSize

mBytesTransferred

public java.lang.String mBytesTransferred

mBytesPerSecond

public int mBytesPerSecond

mChatMsgGuid

public byte[] mChatMsgGuid

mChatMsgIndex

public int mChatMsgIndex

mConversation

public Conversation mConversation
Constructor Detail

Transfer

public Transfer(int oid,
                SidRoot root)
Method Detail

accept

public boolean accept(java.lang.String filenameWithPath)
Accepts an incoming file transfer and saves it to specified file on the local file system. If the specified file exists, SkypeKit will silently overwrite it. Your UI should prompting the user for confirmation in this case and provide a means for canceling the file transfer or specifying a different target file. * @param filenameWithPath Where on the local file system to save the file being transferred. Note that you should specify the path as being fully-qualified. Otherwise, SkypeKit will be assume it to be relative to the SkypeKit runtime path, since the method is actually executed in the runtime context. * @return success Set to true if the specified target file was successfully created on the local file system -and- the initial write(s) succeeded. However, the transfer itself can subsequently fail before completion due to its being canceled (either locally or remotely), network failure, local file system space/write issues, and so forth.


pause

public void pause()
Temporarily pauses an in-progress incoming or outgoing file transfer. For incoming transfers, only this affects the sender and the invoking recipient only. For outgoing transfers, this affects the sender and all recipients.


resume

public void resume()
Resumes a previously paused file transfer.


cancel

public void cancel()
Cancels an in-progress file transfer. Transfer.STATUS will transition to CANCELLED for incoming file transfers and to CANCELLED_BY_REMOTE for outgoing transfers.


sidMultiGet

public SidGetResponding sidMultiGet(Transfer.Property[] requested)
generic multiget of a list of Property

Parameters:
requested - the list of requested properties of Transfer
Returns:
SidGetResponding

sidMultiGet

public static SidGetResponding[] sidMultiGet(Transfer.Property[] requested,
                                             Transfer[] objects)
generic multiget of list of Property for a list of Transfer

Parameters:
requested - the list of requested properties
Returns:
SidGetResponding[] can be casted to (Transfer[]) if all properties are cached

getType

public Transfer.Type getType()
INCOMING / OUTGOING


getPartnerHandle

public java.lang.String getPartnerHandle()
Skype Name of the remote party of the file transfer. If a file is posted in a conversation with more than one participant, Transfer objects are created for each of them - so a transfer is always to one single remote target.


getPartnerDisplayName

public java.lang.String getPartnerDisplayName()
Display name of the remote participant.


getStatus

public Transfer.Status getStatus()
Current state of the transfer


getFailureReason

public Transfer.FailureReason getFailureReason()
Set whenever P_STATUS transitions to FAILED.


getStartTime

public int getStartTime()
UNIX timestamp of when this Transfer instance was instantiated, not when the transfer process actually started (was accepted from receiver side). Do not use this property when calculate the data transfer speed! Instead, monitor changes to P_BYTESPERSECOND.


getFinishTime

public int getFinishTime()
UNIX timestamp of when this Transfer COMPLETED or FAILED. This property is never set if the receiving side (local or remote) canceled the transfer.


getFilePath

public java.lang.String getFilePath()
The path -and- filename of the file being transfered (typically fully qualified). For the receiver, SkypeKit sets this property upon acceptance of the incoming transfer. If not fully qualified, the path is assumed to be relative to the path of the SkypeKit runtime.


getFileName

public java.lang.String getFileName()
The filename -only- of the file being transfered. The receiver side can use this property to pre-populate relevant UI components while prompting the user to accept the incoming transfer.


getFileSize

public java.lang.String getFileSize()
The size of the file being transferred in bytes. Depending on the magnitude of this value, your UI might want to display the size in terms of kilobytes or even megabytes.


getBytesTransferred

public java.lang.String getBytesTransferred()
The number of bytes already transferred. Calculate the percentage of the file transferred so far as:


getBytesPerSecond

public int getBytesPerSecond()
Current data transfer speed in bytes per second. Typically, your UI will want to display this value as kilobytes per second (KBps).


getChatMsgGuid

public byte[] getChatMsgGuid()
The "global ID" of this Transfer's associated Message instance. GUIDs are shared across Skype client instances and across all users that can see this Message.


getChatMsgIndex

public int getChatMsgIndex()
A more or less arbitrary index for ordering multiple file transfers within the UI.


getConversation

public Conversation getConversation()
The "global ID" of this Transfer's associated Conversation (as chained through its associated Message). GUIDs are shared across Skype client instances and across all users that can see this Conversation. Note that currently SkypeKit sets this property for INCOMING file transfers only and returns 0 (zero) for all sending side transfers. This is a known bug.


sidGetStringProperty

public java.lang.String sidGetStringProperty(PropertyEnumConverting prop)
Specified by:
sidGetStringProperty in interface SidGetResponding
Overrides:
sidGetStringProperty in class SidObject

sidGetObjectProperty

public SidObject sidGetObjectProperty(PropertyEnumConverting prop)
Specified by:
sidGetObjectProperty in interface SidGetResponding
Overrides:
sidGetObjectProperty in class SidObject

sidGetIntProperty

public int sidGetIntProperty(PropertyEnumConverting prop)
Specified by:
sidGetIntProperty in interface SidGetResponding
Overrides:
sidGetIntProperty in class SidObject

sidGetEnumProperty

public EnumConverting sidGetEnumProperty(PropertyEnumConverting prop)
Specified by:
sidGetEnumProperty in interface SidGetResponding
Overrides:
sidGetEnumProperty in class SidObject

sidGetBinaryProperty

public byte[] sidGetBinaryProperty(PropertyEnumConverting prop)
Specified by:
sidGetBinaryProperty in interface SidGetResponding
Overrides:
sidGetBinaryProperty in class SidObject

getPropertyAsString

public java.lang.String getPropertyAsString(int prop)

getPropertyAsString

public java.lang.String getPropertyAsString(Transfer.Property prop)

sidOnChangedProperty

protected void sidOnChangedProperty(int propertyId,
                                    int value,
                                    java.lang.String svalue)
Specified by:
sidOnChangedProperty in class SidObject

sidSetProperty

public void sidSetProperty(PropertyEnumConverting prop,
                           java.lang.String newValue)
Specified by:
sidSetProperty in interface SidGetResponding
Overrides:
sidSetProperty in class SidObject

sidSetProperty

public void sidSetProperty(PropertyEnumConverting prop,
                           SidObject newValue)
Specified by:
sidSetProperty in interface SidGetResponding
Overrides:
sidSetProperty in class SidObject

sidSetProperty

public void sidSetProperty(PropertyEnumConverting prop,
                           int newValue)
Specified by:
sidSetProperty in interface SidGetResponding
Overrides:
sidSetProperty in class SidObject

sidSetProperty

public void sidSetProperty(PropertyEnumConverting prop,
                           byte[] newValue)
Specified by:
sidSetProperty in interface SidGetResponding
Overrides:
sidSetProperty in class SidObject

moduleId

public int moduleId()
Specified by:
moduleId in class SidObject


Copyright © 2010, 2011 Skype Technologies. All Rights Reserved.