Package net.dv8tion.jda.core.entities
Class Icon
- java.lang.Object
-
- net.dv8tion.jda.core.entities.Icon
-
public class Icon extends java.lang.Object
Icon containing a base64 encoded jpeg/png/gif/gifv image.
Used to represent various base64 images in the Discord api.
Example:AccountManager.setAvatar(Icon)
.- Since:
- 3.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Icon
from(byte[] data)
Creates anIcon
with the specified image data.static Icon
from(java.io.File file)
Creates anIcon
with the specifiedFile
.static Icon
from(java.io.InputStream stream)
Creates anIcon
with the specifiedInputStream
.java.lang.String
getEncoding()
The base64 encoded data for this Icon
-
-
-
Method Detail
-
getEncoding
public java.lang.String getEncoding()
The base64 encoded data for this Icon- Returns:
- String representation of the encoded data for this icon
-
from
public static Icon from(java.io.File file) throws java.io.IOException
Creates anIcon
with the specifiedFile
.
We here read the specified File and forward the retrieved byte data tofrom(byte[])
.- Parameters:
file
- An existing, not-null file.- Returns:
- An Icon instance representing the specified File
- Throws:
java.lang.IllegalArgumentException
- if the provided file is either null or does not existjava.io.IOException
- if there is a problem while reading the file.- See Also:
IOUtil.readFully(File)
-
from
public static Icon from(java.io.InputStream stream) throws java.io.IOException
Creates anIcon
with the specifiedInputStream
.
We here read the specified InputStream and forward the retrieved byte data tofrom(byte[])
.- Parameters:
stream
- A not-null InputStream.- Returns:
- An Icon instance representing the specified InputStream
- Throws:
java.lang.IllegalArgumentException
- if the provided stream is nulljava.io.IOException
- If the first byte cannot be read for any reason other than the end of the file, if the input stream has been closed, or if some other I/O error occurs.- See Also:
IOUtil.readFully(InputStream)
-
-