Class Image

java.lang.Object
discord4j.rest.util.Image

public final class Image extends Object
Represents a Discord image.
See Also:
  • Method Details

    • ofRaw

      public static Image ofRaw(byte[] data, Image.Format format)
      Constructs an Image utilizing raw image data.
      Parameters:
      data - The raw image data.
      format - The Image.Format of the data.
      Returns:
      An Image with raw image data.
    • ofUrl

      public static Mono<Image> ofUrl(String url)
      Constructs an Image using the resource at the given url.
      Parameters:
      url - The url of the image.
      Returns:
      A Mono where, upon successful completion, emits an Image with the data at the url. If an error is received, it is emitted through the Mono.
    • getData

      public byte[] getData()
      Gets the raw data of the image.
      Returns:
      The raw data of the image.
    • getFormat

      public Image.Format getFormat()
      Gets the format of the image.
      Returns:
      The format of the image.
    • getHash

      public String getHash()
      Gets the Base64-encoded data of the image.
      Returns:
      The Base64-encoded data of the image.
    • getDataUri

      public String getDataUri()
      Gets a data URI for this image.
      Returns:
      The data URI for this image.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object