Class Favicon


  • public final class Favicon
    extends java.lang.Object
    Represents a Minecraft server favicon. A Minecraft server favicon is a 64x64 image that can be displayed to a remote client that sends a Server List Ping packet, and is automatically displayed in the Minecraft client.
    • Constructor Summary

      Constructors 
      Constructor Description
      Favicon​(java.lang.String base64Url)
      Directly create a favicon using its Base64 URL directly.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Favicon create​(byte[] buffer)
      Creates a new Favicon from the specified buffer.
      static Favicon create​(java.nio.file.Path path)
      Creates a new Favicon by reading the image from the specified path.
      boolean equals​(@Nullable java.lang.Object o)  
      java.lang.String getBase64Url()
      Returns the Base64-encoded URI for this image.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Favicon

        public Favicon​(java.lang.String base64Url)
        Directly create a favicon using its Base64 URL directly. You are generally better served by the create() series of functions.
        Parameters:
        base64Url - the url for use with this favicon
    • Method Detail

      • getBase64Url

        public java.lang.String getBase64Url()
        Returns the Base64-encoded URI for this image.
        Returns:
        a URL representing this favicon
      • equals

        public boolean equals​(@Nullable java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • create

        public static Favicon create​(byte[] buffer)
                              throws java.io.IOException
        Creates a new Favicon from the specified buffer.
        Parameters:
        buffer - the buffer to use for the favicon
        Returns:
        the created Favicon instance
        Throws:
        java.io.IOException - if the file could not be read from the path
      • create

        public static Favicon create​(java.nio.file.Path path)
                              throws java.io.IOException
        Creates a new Favicon by reading the image from the specified path.
        Parameters:
        path - the path to the image to create a favicon for
        Returns:
        the created Favicon instance
        Throws:
        java.io.IOException - if the file could not be read from the path