public final class FileTransferManager extends Manager
| Modifier and Type | Method and Description |
|---|---|
void |
addFileTransferOfferListener(Consumer<FileTransferOfferEvent> fileTransferOfferListener)
Adds a file transfer listener, which allows to listen for inbound file transfer requests.
|
void |
fileTransferOffered(IQ iq,
String sessionId,
String mimeType,
FileTransferOffer fileTransferOffer,
Object protocol,
FileTransferNegotiator fileTransferNegotiator) |
static String |
md5Hash(Path source)
Calculates the MD5 hash for a file.
|
AsyncResult<FileTransfer> |
offerFile(File file,
String description,
rocks.xmpp.addr.Jid recipient,
Duration timeout)
Offers a file to another user.
|
AsyncResult<FileTransfer> |
offerFile(InputStream source,
String fileName,
long fileSize,
Instant lastModified,
String description,
rocks.xmpp.addr.Jid recipient,
Duration timeout)
Offers a stream to another user.
|
AsyncResult<FileTransfer> |
offerFile(InputStream source,
String fileName,
long fileSize,
Instant lastModified,
String description,
rocks.xmpp.addr.Jid recipient,
Duration timeout,
String sessionId)
Offers a stream to another user.
|
AsyncResult<FileTransfer> |
offerFile(InputStream source,
String fileName,
long fileSize,
Instant lastModified,
String description,
rocks.xmpp.addr.Jid recipient,
Duration timeout,
String sessionId,
String mimeType,
String hash)
Offers a stream to another user.
|
AsyncResult<FileTransfer> |
offerFile(Path source,
String description,
rocks.xmpp.addr.Jid recipient,
Duration timeout)
Offers a file to another user.
|
AsyncResult<FileTransfer> |
offerFile(Path source,
String description,
rocks.xmpp.addr.Jid recipient,
Duration timeout,
String mimeType,
boolean calculateHash)
Offers a file to another user.
|
AsyncResult<IQ> |
offerFile(URI uri,
String description,
rocks.xmpp.addr.Jid recipient,
Duration timeout)
Offers a file to another user in form of an URL.
|
AsyncResult<IQ> |
offerFile(URL url,
String description,
rocks.xmpp.addr.Jid recipient,
Duration timeout)
Deprecated.
|
void |
removeFileTransferOfferListener(Consumer<FileTransferOfferEvent> fileTransferOfferListener)
Removes a previously added file transfer listener.
|
isEnabled, setEnabledpublic static String md5Hash(Path source) throws IOException
source - The source path.IOException - If the file could not be read.@Deprecated public final AsyncResult<IQ> offerFile(URL url, String description, rocks.xmpp.addr.Jid recipient, Duration timeout)
offerFile(URI, String, Jid, Duration)url - The URL of the file.description - The description of the file.recipient - The recipient's JID (must be a full JID).timeout - The timeout (indicates how long to wait until the file offer has either been accepted or rejected).public final AsyncResult<IQ> offerFile(URI uri, String description, rocks.xmpp.addr.Jid recipient, Duration timeout)
uri - The URI of the file.description - The description of the file.recipient - The recipient's JID (must be a full JID).timeout - The timeout (indicates how long to wait until the file offer has either been accepted or rejected).public final AsyncResult<FileTransfer> offerFile(File file, String description, rocks.xmpp.addr.Jid recipient, Duration timeout) throws IOException
FileTransfer.transfer() to start the file transfer.file - The file.description - The description of the file.recipient - The recipient's JID (must be a full JID, i. e. including resource).timeout - The timeout (indicates how long to wait until the file offer has either been accepted or rejected).IOException - If the file can't be read.public final AsyncResult<FileTransfer> offerFile(Path source, String description, rocks.xmpp.addr.Jid recipient, Duration timeout) throws IOException
FileTransfer.transfer() to start the file transfer.source - The file.description - The description of the file.recipient - The recipient's JID (must be a full JID, i. e. including resource).timeout - The timeout (indicates how long to wait until the file offer has either been accepted or rejected).IOException - If the file can't be read.public final AsyncResult<FileTransfer> offerFile(Path source, String description, rocks.xmpp.addr.Jid recipient, Duration timeout, String mimeType, boolean calculateHash) throws IOException
FileTransfer.transfer() to start the file transfer.source - The file.description - The description of the file.recipient - The recipient's JID (must be a full JID, i. e. including resource).timeout - The timeout (indicates how long to wait until the file offer has either been accepted or rejected).mimeType - The mime type. If null, the mime type is guessed.calculateHash - If true, the MD5 hash for the file is calculated and included in the offer.IOException - If the file can't be read.public final AsyncResult<FileTransfer> offerFile(InputStream source, String fileName, long fileSize, Instant lastModified, String description, rocks.xmpp.addr.Jid recipient, Duration timeout)
FileTransfer.transfer() to start the file transfer.source - The stream.fileName - The file name.fileSize - The file size.lastModified - The last modified date.description - The description of the file.recipient - The recipient's JID (must be a full JID, i. e. including resource).timeout - The timeout (indicates how long to wait until the file offer has either been accepted or rejected).public final AsyncResult<FileTransfer> offerFile(InputStream source, String fileName, long fileSize, Instant lastModified, String description, rocks.xmpp.addr.Jid recipient, Duration timeout, String sessionId)
FileTransfer.transfer() to start the file transfer.source - The stream.fileName - The file name.fileSize - The file size.lastModified - The last modified date.description - The description of the file.recipient - The recipient's JID (must be a full JID, i. e. including resource).timeout - The timeout (indicates how long to wait until the file offer has either been accepted or rejected).sessionId - The session id.public final AsyncResult<FileTransfer> offerFile(InputStream source, String fileName, long fileSize, Instant lastModified, String description, rocks.xmpp.addr.Jid recipient, Duration timeout, String sessionId, String mimeType, String hash)
FileTransfer.transfer() to start the file transfer.source - The stream.fileName - The file name.fileSize - The file size.lastModified - The last modified date.description - The description of the file.recipient - The recipient's JID (must be a full JID, i. e. including resource).timeout - The timeout (indicates how long to wait until the file offer has either been accepted or rejected).sessionId - The session id.mimeType - The mime type. If null, the mime type is guessed.hash - The hash (maybe null). As per the specification this should be a hex-encoded MD5 hash.md5Hash(Path)public void fileTransferOffered(IQ iq, String sessionId, String mimeType, FileTransferOffer fileTransferOffer, Object protocol, FileTransferNegotiator fileTransferNegotiator)
public void addFileTransferOfferListener(Consumer<FileTransferOfferEvent> fileTransferOfferListener)
fileTransferOfferListener - The listener.removeFileTransferOfferListener(Consumer)public void removeFileTransferOfferListener(Consumer<FileTransferOfferEvent> fileTransferOfferListener)
fileTransferOfferListener - The listener.addFileTransferOfferListener(Consumer)Copyright © 2014–2017 XMPP.rocks. All rights reserved.