Interface Favicon


public sealed interface Favicon
A favicon encoded as PNG image data.

Status responses require favicons to be 64 by 64 pixels. Factory methods validate the source image and encode it as PNG data.

Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Gets the PNG-encoded favicon image data.
    static Favicon
    Creates a favicon from an image.
    static Favicon
    read(InputStream stream)
    Reads a favicon from an image stream.
    static Favicon
    read(Path path)
    Reads a favicon from an image file.
  • Method Details

    • data

      @Contract(value=" -> new", pure=true) byte[] data()
      Gets the PNG-encoded favicon image data.
      Returns:
      a clone of the favicon data
      Since:
      0.1.0
    • read

      @Contract(value="_ -> new", pure=true) static Favicon read(Path path) throws IOException
      Reads a favicon from an image file.
      Parameters:
      path - path to the image file
      Returns:
      favicon encoded as PNG data
      Throws:
      IOException - if the image cannot be read or encoded
      IllegalArgumentException - if the image format is unsupported or the image is not 64 by 64 pixels
      Since:
      0.1.0
    • read

      @Contract(value="_ -> new", pure=true) static Favicon read(InputStream stream) throws IOException
      Reads a favicon from an image stream.
      Parameters:
      stream - stream containing image data
      Returns:
      favicon encoded as PNG data
      Throws:
      IOException - if the image cannot be read or encoded
      IllegalArgumentException - if the image format is unsupported or the image is not 64 by 64 pixels
      Since:
      0.1.0
    • of

      @Contract(value="_ -> new", pure=true) static Favicon of(BufferedImage image) throws IOException
      Creates a favicon from an image.
      Parameters:
      image - source image
      Returns:
      favicon encoded as PNG data
      Throws:
      IOException - if the image cannot be encoded
      IllegalArgumentException - if the image is not 64 by 64 pixels
      Since:
      0.1.0