Package rocks.xmpp.extensions.avatar
Interface AvatarManager
-
- All Known Implementing Classes:
AbstractAvatarManager
,CombinedAvatarManager
,UserAvatarProtocol
,VCardBasedAvatarsProtocol
public interface AvatarManager
In XMPP two extension protocols are defined which both deal with avatars.This interface provides a common abstraction for both of these protocols, which involves these use cases: Publishing avatars, retrieving avatars and listening for avatar updates.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAvatarChangeListener(Consumer<AvatarChangeEvent> avatarChangeListener)
Adds an avatar change listener which listens for avatar updates from other contacts.AsyncResult<byte[]>
getAvatar(Jid contact)
Gets the user avatar as byte array.AsyncResult<BufferedImage>
getAvatarImage(Jid contact)
Gets the user avatar.AsyncResult<Void>
publishAvatar(byte[] imageData)
Publishes an avatar.AsyncResult<Void>
publishAvatarImage(BufferedImage bufferedImage)
Publishes an avatar.void
removeAvatarChangeListener(Consumer<AvatarChangeEvent> avatarChangeListener)
Removes an avatar change listener.
-
-
-
Method Detail
-
getAvatar
AsyncResult<byte[]> getAvatar(Jid contact)
Gets the user avatar as byte array.- Parameters:
contact
- The contact. Must not benull
.- Returns:
- The async result with the contact's avatar or null, if it has no avatar.
-
getAvatarImage
AsyncResult<BufferedImage> getAvatarImage(Jid contact)
Gets the user avatar.- Parameters:
contact
- The contact. Must not benull
.- Returns:
- The async result with the contact's avatar or null, if it has no avatar.
-
publishAvatar
AsyncResult<Void> publishAvatar(byte[] imageData)
Publishes an avatar.- Parameters:
imageData
- The avatar image data, which must be in PNG format.null
resets the avatar.- Returns:
- The async result.
-
publishAvatarImage
AsyncResult<Void> publishAvatarImage(BufferedImage bufferedImage) throws XmppException
Publishes an avatar.- Parameters:
bufferedImage
- The avatar image, which must be in PNG format.null
resets the avatar.- Returns:
- The async result.
- Throws:
XmppException
- If the image could not be converted to PNG.
-
addAvatarChangeListener
void addAvatarChangeListener(Consumer<AvatarChangeEvent> avatarChangeListener)
Adds an avatar change listener which listens for avatar updates from other contacts.- Parameters:
avatarChangeListener
- The listener.- See Also:
removeAvatarChangeListener(Consumer)
-
removeAvatarChangeListener
void removeAvatarChangeListener(Consumer<AvatarChangeEvent> avatarChangeListener)
Removes an avatar change listener.- Parameters:
avatarChangeListener
- The listener.- See Also:
addAvatarChangeListener(Consumer)
-
-