public class FileTransferManager extends Object implements Initializable
FileTransferManager is application facing class used to setup ability
to transfer files across the network.
XMPP as a protocol is not suitable for media/file transfer; it allows to plug-in other technologies for media transfer. In addition to the various technologies such as SOCKS5, Out-of-band transfer etc, Stringflow has its Proprietary content model to transfer media content.
Stringflow content model uses MIME as underlying technology to transfer
media. As recommended in various XEP specifications, media transfer
negotiations take place on the XMPP stream; however the media/file is
transferred on a TCP connection as a MIME message. When a user wants to
transfer a media to another user, Stringflow transfers the thumb nail image,
media type and size to the destination user over XMPP message stream keeping
message ordering in place and real-time. Simultaneously, a request to
transfer the file is handed-over to FileTransferManager to transfer
the file in background.
| Modifier and Type | Method and Description |
|---|---|
static FileTransferManager |
getInstance() |
void |
init()
Initialize this instance
|
boolean |
isInitialized()
Check if the
FileTransferManager instance has been initialized |
void |
setFileReceiveRequestFilter(InboundFileTransferFilter fileReceiveRequestFilter) |
void |
setFileSupplier(FileInstanceSupplier fileSupplier) |
void |
setXmppStreamManager(XMPPStreamManager xmppStreamManager) |
void |
shutdown()
Shutdown
FileTransferManager |
FileTransferFuture |
transferFileInbound(JID from,
String fileId,
ContentType contentType)
File thumb and its unique id is transferred to receiver immediately.
|
void |
transferFileInbound(JID from,
String fileId,
ContentType contentType,
Callback<File,FileTransfer.FailureReason> callback)
File thumb and its unique id is transferred to receiver immediately.
|
FileTransferFuture |
transferFileOutbound(String mediaId,
File file,
ContentType contentType,
JID to) |
void |
transferFileOutbound(String messageId,
File file,
ContentType contentType,
JID to,
Callback<String,FileTransfer.FailureReason> callback)
Sends message with
MediaContent to media receiver. |
public static FileTransferManager getInstance()
public void init()
throws InitializationErrorException
init in interface InitializableInitializationErrorException - if any exception/error encountered
while executing initialization hookpublic void transferFileInbound(JID from, String fileId, ContentType contentType, Callback<File,FileTransfer.FailureReason> callback)
Receiving a file involves sending an IQ stanza to server
requesting file download. On success result of the IQ, client
initiates a MIME Connection with the server on which server
writes the file.
from - JIDfileId - stringcontentType - ContentTypecallback - Callbackpublic FileTransferFuture transferFileInbound(JID from, String fileId, ContentType contentType)
Receiving a file involves sending an IQ stanza to server
requesting file download. On success result of the IQ, client
initiates a MIME Connection with the server on which server
writes the file.
from - JIDfileId - stringcontentType - ContentTypepublic FileTransferFuture transferFileOutbound(String mediaId, File file, ContentType contentType, JID to)
public void transferFileOutbound(String messageId, File file, ContentType contentType, JID to, Callback<String,FileTransfer.FailureReason> callback)
MediaContent to media receiver. And uploads
given file to Stringflow server.messageId - Id for media messagefile - File object of mediacontentType - ContentType of media fileto - JID of media message receivercallback - callback to know file transfer statuspublic void setXmppStreamManager(XMPPStreamManager xmppStreamManager)
public void setFileSupplier(FileInstanceSupplier fileSupplier)
public void setFileReceiveRequestFilter(InboundFileTransferFilter fileReceiveRequestFilter)
public boolean isInitialized()
FileTransferManager instance has been initializedpublic void shutdown()
throws IOException
FileTransferManagerIOException - ioexceptionCopyright © 2019. All rights reserved.