public class FileTransferNegotiator
extends org.jivesoftware.smack.Manager
Modifier and Type | Field and Description |
---|---|
static boolean |
IBB_ONLY
A static variable to use only offer IBB for file transfer.
|
static java.lang.String |
SI_NAMESPACE |
static java.lang.String |
SI_PROFILE_FILE_TRANSFER_NAMESPACE |
protected static java.lang.String |
STREAM_DATA_FIELD_NAME |
Modifier and Type | Method and Description |
---|---|
static FileTransferNegotiator |
getInstanceFor(org.jivesoftware.smack.XMPPConnection 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(org.jivesoftware.smack.XMPPConnection 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.
|
StreamNegotiator |
selectStreamNegotiator(FileTransferRequest request)
Selects an appropriate stream negotiator after examining the incoming file transfer request.
|
public static final java.lang.String SI_NAMESPACE
public static final java.lang.String SI_PROFILE_FILE_TRANSFER_NAMESPACE
protected static final java.lang.String STREAM_DATA_FIELD_NAME
public static boolean IBB_ONLY
public static FileTransferNegotiator getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
connection
- The connection for which the transfer manager is desiredpublic static boolean isServiceEnabled(org.jivesoftware.smack.XMPPConnection connection)
connection
- The connection to checkpublic static java.util.Collection<java.lang.String> getSupportedProtocols()
public StreamNegotiator selectStreamNegotiator(FileTransferRequest request) throws org.jivesoftware.smack.SmackException.NotConnectedException, FileTransferException.NoStreamMethodsOfferedException, FileTransferException.NoAcceptableTransferMechanisms
request
- The related file transfer request.FileTransferException.NoStreamMethodsOfferedException
- If there are either no stream methods contained in the packet, or
there is not an appropriate stream method.org.jivesoftware.smack.SmackException.NotConnectedException
FileTransferException.NoAcceptableTransferMechanisms
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 org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, org.jivesoftware.smack.SmackException.NoResponseException, FileTransferException.NoAcceptableTransferMechanisms
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, thisorg.jivesoftware.smack.XMPPException.XMPPErrorException
- Thrown if there is an error negotiating the file transfer.org.jivesoftware.smack.SmackException.NotConnectedException
org.jivesoftware.smack.SmackException.NoResponseException
FileTransferException.NoAcceptableTransferMechanisms