public final class HttpFileUploadManager
extends org.jivesoftware.smack.Manager
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NAMESPACE
Namespace of XEP-0363 v0.4 or higher.
|
static java.lang.String |
NAMESPACE_0_2
Namespace of XEP-0363 v0.2 or lower.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
discoverUploadService()
Discover upload service.
|
UploadService |
getDefaultUploadService()
Get default upload service if it was discovered.
|
static HttpFileUploadManager |
getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
Obtain the HttpFileUploadManager responsible for a connection.
|
boolean |
isUploadServiceDiscovered()
Check if upload service was discovered.
|
static UploadService.Version |
namespaceToVersion(java.lang.String namespace) |
Slot |
requestSlot(java.lang.String filename,
long fileSize)
Request a new upload slot from default upload service (if discovered).
|
Slot |
requestSlot(java.lang.String filename,
long fileSize,
java.lang.String contentType)
Request a new upload slot with optional content type from default upload service (if discovered).
|
Slot |
requestSlot(java.lang.String filename,
long fileSize,
java.lang.String contentType,
org.jxmpp.jid.DomainBareJid uploadServiceAddress)
Request a new upload slot with optional content type from custom upload service.
|
void |
setTlsContext(javax.net.ssl.SSLContext tlsContext) |
java.net.URL |
uploadFile(java.io.File file)
Request slot and uploaded file to HTTP file upload service.
|
java.net.URL |
uploadFile(java.io.File file,
UploadProgressListener listener)
Request slot and uploaded file to HTTP file upload service with progress callback.
|
java.net.URL |
uploadFile(java.io.InputStream inputStream,
java.lang.String fileName,
long fileSize)
Request slot and uploaded stream to HTTP upload service.
|
java.net.URL |
uploadFile(java.io.InputStream inputStream,
java.lang.String fileName,
long fileSize,
UploadProgressListener listener)
Request slot and uploaded stream to HTTP upload service.
|
public static final java.lang.String NAMESPACE
public static final java.lang.String NAMESPACE_0_2
public static HttpFileUploadManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
connection - the connection object.public boolean discoverUploadService()
throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
java.lang.InterruptedException,
org.jivesoftware.smack.SmackException.NoResponseException
XMPPException.XMPPErrorException - if there was an XMPP error returned.SmackException.NotConnectedException - if the XMPP connection is not connected.java.lang.InterruptedException - if the calling thread was interrupted.SmackException.NoResponseException - if there was no response from the remote entity.public boolean isUploadServiceDiscovered()
public UploadService getDefaultUploadService()
public java.net.URL uploadFile(java.io.File file)
throws java.lang.InterruptedException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException,
java.io.IOException
file - file to be uploadedjava.lang.InterruptedException - if the calling thread was interrupted.XMPPException.XMPPErrorException - if there was an XMPP error returned.org.jivesoftware.smack.SmackException - if Smack detected an exceptional situation.java.io.IOException - in case of HTTP upload errorspublic java.net.URL uploadFile(java.io.File file,
UploadProgressListener listener)
throws java.lang.InterruptedException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException,
java.io.IOException
file - file to be uploadedlistener - Upload progress listener or nulljava.lang.InterruptedException - if the calling thread was interrupted.XMPPException.XMPPErrorException - if there was an XMPP error returned.org.jivesoftware.smack.SmackException - if Smack detected an exceptional situation.java.io.IOException - if an I/O error occurred.public java.net.URL uploadFile(java.io.InputStream inputStream,
java.lang.String fileName,
long fileSize)
throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
java.lang.InterruptedException,
org.jivesoftware.smack.SmackException,
java.io.IOException
inputStream - Input stream used for the upload.fileName - Name of the file.fileSize - Size of the file.org.jivesoftware.smack.XMPPException.XMPPErrorException - XMPPErrorException if there was an XMPP error returned.java.lang.InterruptedException - If the calling thread was interrupted.org.jivesoftware.smack.SmackException - If Smack detected an exceptional situation.java.io.IOException - If an I/O error occurred.public java.net.URL uploadFile(java.io.InputStream inputStream,
java.lang.String fileName,
long fileSize,
UploadProgressListener listener)
throws org.jivesoftware.smack.XMPPException.XMPPErrorException,
java.lang.InterruptedException,
org.jivesoftware.smack.SmackException,
java.io.IOException
inputStream - Input stream used for the upload.fileName - Name of the file.fileSize - file size in bytes.listener - upload progress listener or null.org.jivesoftware.smack.XMPPException.XMPPErrorException - XMPPErrorException if there was an XMPP error returned.java.lang.InterruptedException - If the calling thread was interrupted.org.jivesoftware.smack.SmackException - If Smack detected an exceptional situation.java.io.IOException - If an I/O error occurred.public Slot requestSlot(java.lang.String filename, long fileSize) throws java.lang.InterruptedException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException
filename - name of file to be uploadedfileSize - file size in bytes.java.lang.IllegalArgumentException - if fileSize is less than or equal to zero or greater than the maximum size
supported by the service.java.lang.InterruptedException - if the calling thread was interrupted.XMPPException.XMPPErrorException - if there was an XMPP error returned.org.jivesoftware.smack.SmackException - if smack exception.public Slot requestSlot(java.lang.String filename, long fileSize, java.lang.String contentType) throws org.jivesoftware.smack.SmackException, java.lang.InterruptedException, org.jivesoftware.smack.XMPPException.XMPPErrorException
filename - name of file to be uploadedfileSize - file size in bytes.contentType - file content-type or nulljava.lang.IllegalArgumentException - if fileSize is less than or equal to zero or greater than the maximum size
supported by the service.SmackException.NotConnectedException - if the XMPP connection is not connected.java.lang.InterruptedException - if the calling thread was interrupted.XMPPException.XMPPErrorException - if there was an XMPP error returned.org.jivesoftware.smack.SmackException - if smack exception.public Slot requestSlot(java.lang.String filename, long fileSize, java.lang.String contentType, org.jxmpp.jid.DomainBareJid uploadServiceAddress) throws org.jivesoftware.smack.SmackException, java.lang.InterruptedException, org.jivesoftware.smack.XMPPException.XMPPErrorException
filename - name of file to be uploadedfileSize - file size in bytes.contentType - file content-type or nulluploadServiceAddress - the address of the upload service to use or null for default onejava.lang.IllegalArgumentException - if fileSize is less than or equal to zero or greater than the maximum size
supported by the service.org.jivesoftware.smack.SmackException - if Smack detected an exceptional situation.java.lang.InterruptedException - if the calling thread was interrupted.XMPPException.XMPPErrorException - if there was an XMPP error returned.public void setTlsContext(javax.net.ssl.SSLContext tlsContext)
public static UploadService.Version namespaceToVersion(java.lang.String namespace)