Class SunPNGEncoderAdapter

  • All Implemented Interfaces:
    ImageEncoder

    public class SunPNGEncoderAdapter
    extends Object
    implements ImageEncoder
    Adapter class for the Sun PNG Encoder. The ImageEncoderFactory will only return a reference to this class by default if the library has been compiled under a JDK 1.4+ and is being run using a JDK 1.4+.
    • Constructor Detail

      • SunPNGEncoderAdapter

        public SunPNGEncoderAdapter()
    • Method Detail

      • getQuality

        public float getQuality()
        Get the quality of the image encoding (always 0.0).
        Specified by:
        getQuality in interface ImageEncoder
        Returns:
        A float representing the quality.
      • setQuality

        public void setQuality​(float quality)
        Set the quality of the image encoding (not supported in this ImageEncoder).
        Specified by:
        setQuality in interface ImageEncoder
        Parameters:
        quality - A float representing the quality.
      • isEncodingAlpha

        public boolean isEncodingAlpha()
        Get whether the encoder should encode alpha transparency (always false).
        Specified by:
        isEncodingAlpha in interface ImageEncoder
        Returns:
        Whether the encoder is encoding alpha transparency.
      • setEncodingAlpha

        public void setEncodingAlpha​(boolean encodingAlpha)
        Set whether the encoder should encode alpha transparency (not supported in this ImageEncoder).
        Specified by:
        setEncodingAlpha in interface ImageEncoder
        Parameters:
        encodingAlpha - Whether the encoder should encode alpha transparency.
      • encode

        public byte[] encode​(BufferedImage bufferedImage)
                      throws IOException
        Encodes an image in PNG format.
        Specified by:
        encode in interface ImageEncoder
        Parameters:
        bufferedImage - The image to be encoded.
        Returns:
        The byte[] that is the encoded image.
        Throws:
        IOException - if there is an IO problem.
      • encode

        public void encode​(BufferedImage bufferedImage,
                           OutputStream outputStream)
                    throws IOException
        Encodes an image in PNG format and writes it to an OutputStream.
        Specified by:
        encode in interface ImageEncoder
        Parameters:
        bufferedImage - The image to be encoded.
        outputStream - The OutputStream to write the encoded image to.
        Throws:
        IOException - if there is an IO problem.