Interface ImageEncoder

  • All Known Implementing Classes:
    JpegImageEncoder, PngEncoder

    public interface ImageEncoder
    A image encoder. The encoder's encodeImage method must be synchronized in some way, so that multiple calls from multiple threads do not interact with each other.
    Author:
    Thomas Morgner
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void encodeImage​(Image image, OutputStream outputStream, float quality, boolean encodeAlpha)
      Encodes the given image using the given encoder-specific quality and alpha-channel settings and writes the encoded image-data to the given stream.
      String getMimeType()
      Returns the mime-type of the encoded data.
    • Method Detail

      • encodeImage

        void encodeImage​(Image image,
                         OutputStream outputStream,
                         float quality,
                         boolean encodeAlpha)
                  throws IOException,
                         UnsupportedEncoderException
        Encodes the given image using the given encoder-specific quality and alpha-channel settings and writes the encoded image-data to the given stream.
        Parameters:
        image - the image to be encoded.
        outputStream - the output stream, where to write the image data to.
        quality - the quality of the encoding.
        encodeAlpha - a flag controlling whether the alpha-channel should be encoded as well.
        Throws:
        IOException - if there was an IO error while generating or writing the image data.
        UnsupportedEncoderException - if the encoder is not supported.
      • getMimeType

        String getMimeType()
        Returns the mime-type of the encoded data.
        Returns:
        the mime-type.