|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.smackx.filetransfer.FileTransferNegotiator
public class FileTransferNegotiator
Manages the negotiation of file transfers according to JEP-0096. If a file is being sent the remote user chooses the type of stream under which the file will be sent.
Field Summary | |
---|---|
static boolean |
IBB_ONLY
A static variable to use only offer IBB for file transfer. |
protected static java.lang.String |
STREAM_DATA_FIELD_NAME
|
Method Summary | |
---|---|
static IQ |
createIQ(java.lang.String ID,
java.lang.String to,
java.lang.String from,
IQ.Type type)
A convenience method to create an IQ packet. |
static FileTransferNegotiator |
getInstanceFor(Connection connection)
Returns the file transfer negotiator related to a particular connection. |
java.lang.String |
getNextStreamID()
Returns a new, unique, stream ID to identify a file transfer. |
static java.util.Collection<java.lang.String> |
getSupportedProtocols()
Returns a collection of the supported transfer protocols. |
static boolean |
isServiceEnabled(Connection connection)
Checks to see if all file transfer related services are enabled on the connection. |
StreamNegotiator |
negotiateOutgoingTransfer(java.lang.String userID,
java.lang.String streamID,
java.lang.String fileName,
long size,
java.lang.String desc,
int responseTimeout)
Send a request to another user to send them a file. |
void |
rejectStream(StreamInitiation si)
Reject a stream initiation request from a remote user. |
StreamNegotiator |
selectStreamNegotiator(FileTransferRequest request)
Selects an appropriate stream negotiator after examining the incoming file transfer request. |
static void |
setServiceEnabled(Connection connection,
boolean isEnabled)
Enable the Jabber services related to file transfer on the particular connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String STREAM_DATA_FIELD_NAME
public static boolean IBB_ONLY
Method Detail |
---|
public static FileTransferNegotiator getInstanceFor(Connection connection)
connection
- The connection for which the transfer manager is desired
public static void setServiceEnabled(Connection connection, boolean isEnabled)
connection
- The connection on which to enable or disable the services.isEnabled
- True to enable, false to disable.public static boolean isServiceEnabled(Connection connection)
connection
- The connection to check
public static IQ createIQ(java.lang.String ID, java.lang.String to, java.lang.String from, IQ.Type type)
ID
- The packet ID of theto
- To whom the packet is addressed.from
- From whom the packet is sent.type
- The IQ type of the packet.
public static java.util.Collection<java.lang.String> getSupportedProtocols()
public StreamNegotiator selectStreamNegotiator(FileTransferRequest request) throws XMPPException
request
- The related file transfer request.
XMPPException
- If there are either no stream methods contained in the packet, or
there is not an appropriate stream method.public void rejectStream(StreamInitiation si)
si
- The Stream Initiation request to reject.public java.lang.String getNextStreamID()
public StreamNegotiator negotiateOutgoingTransfer(java.lang.String userID, java.lang.String streamID, java.lang.String fileName, long size, java.lang.String desc, int responseTimeout) throws XMPPException
userID
- The userID of the user to whom the file will be sent.streamID
- The unique identifier for this file transfer.fileName
- The name of this file. Preferably it should include an
extension as it is used to determine what type of file it is.size
- The size, in bytes, of the file.desc
- A description of the file.responseTimeout
- The amount of time, in milliseconds, to wait for the remote
user to respond. If they do not respond in time, this
XMPPException
- Thrown if there is an error negotiating the file transfer.
|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |