blob: 854fc0c5e69b168487046dffe1c580d827c4039e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.protocol.jabber;
import java.io.*;
import net.java.sip.communicator.service.protocol.*;
import org.jivesoftware.smackx.filetransfer.*;
/**
* The Jabber protocol extension of the <tt>AbstractFileTransfer</tt>.
*
* @author Yana Stamcheva
*/
public class IncomingFileTransferJabberImpl
extends AbstractFileTransfer
{
private final String id;
private final Contact sender;
private final File file;
/**
* The Jabber incoming file transfer.
*/
private IncomingFileTransfer jabberTransfer;
/**
* Creates an <tt>IncomingFileTransferJabberImpl</tt>.
*
* @param id the identifier of this transfer
* @param sender the sender of the file
* @param file the file
* @param jabberTransfer the Jabber file transfer object
*/
public IncomingFileTransferJabberImpl( String id,
Contact sender,
File file,
IncomingFileTransfer jabberTransfer)
{
this.id = id;
this.sender = sender;
this.file = file;
this.jabberTransfer = jabberTransfer;
}
/**
* Cancels the file transfer.
*/
public void cancel()
{
this.jabberTransfer.cancel();
}
/**
* Returns the number of bytes already received from the recipient.
*
* @return the number of bytes already received from the recipient
*/
public long getTransferedBytes()
{
return jabberTransfer.getAmountWritten();
}
/**
* The direction is incoming.
*
* @return IN
*/
public int getDirection()
{
return IN;
}
/**
* Returns the sender of the file.
*
* @return the sender of the file
*/
public Contact getContact()
{
return sender;
}
/**
* Returns the identifier of this file transfer.
*
* @return the identifier of this file transfer
*/
public String getID()
{
return id;
}
/**
* Returns the local file that is being transferred or to which we transfer.
*
* @return the file
*/
public File getLocalFile()
{
return file;
}
}
|