Class JpegImageHelper


  • class JpegImageHelper
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static byte[] JFIF_ID
      sequence that is used in all Jpeg files
      private static org.slf4j.Logger LOGGER  
      private static int M_APP0
      Marker value
      private static int M_APP2
      Marker value
      private static int M_APPD
      Marker value for Photoshop IRB
      private static int M_APPE
      Marker value
      private static int NOPARAM_MARKER
      This is a type of marker.
      private static int[] NOPARAM_MARKERS
      Jpeg markers without additional parameters.
      private static int NOT_A_MARKER
      This is a type of marker.
      private static byte[] PS_8BIM_RESO
      sequence preceding Photoshop resolution data
      private static int UNSUPPORTED_MARKER
      This is a type of marker.
      private static int[] UNSUPPORTED_MARKERS
      Unsupported Jpeg markers.
      private static int VALID_MARKER
      This is a type of marker.
      private static int[] VALID_MARKERS
      Acceptable Jpeg markers.
    • Constructor Summary

      Constructors 
      Constructor Description
      JpegImageHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static void attemptToSetIccProfileToImage​(byte[][] icc, ImageData image)  
      private static int getShort​(java.io.InputStream jpegStream)
      Reads a short from the InputStream.
      private static int marker​(int marker)
      Returns a type of marker.
      static void processImage​(ImageData image)
      Process the passed Image data as a JPEG image.
      private static void processParameters​(java.io.InputStream jpegStream, java.lang.String errorID, ImageData image)
      This method checks if the image is a valid JPEG and processes some parameters.
      private static void updateAttributes​(ImageData image)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • NOT_A_MARKER

        private static final int NOT_A_MARKER
        This is a type of marker.
        See Also:
        Constant Field Values
      • VALID_MARKER

        private static final int VALID_MARKER
        This is a type of marker.
        See Also:
        Constant Field Values
      • VALID_MARKERS

        private static final int[] VALID_MARKERS
        Acceptable Jpeg markers.
      • UNSUPPORTED_MARKER

        private static final int UNSUPPORTED_MARKER
        This is a type of marker.
        See Also:
        Constant Field Values
      • UNSUPPORTED_MARKERS

        private static final int[] UNSUPPORTED_MARKERS
        Unsupported Jpeg markers.
      • NOPARAM_MARKER

        private static final int NOPARAM_MARKER
        This is a type of marker.
        See Also:
        Constant Field Values
      • NOPARAM_MARKERS

        private static final int[] NOPARAM_MARKERS
        Jpeg markers without additional parameters.
      • JFIF_ID

        private static final byte[] JFIF_ID
        sequence that is used in all Jpeg files
      • PS_8BIM_RESO

        private static final byte[] PS_8BIM_RESO
        sequence preceding Photoshop resolution data
    • Constructor Detail

      • JpegImageHelper

        JpegImageHelper()
    • Method Detail

      • processImage

        public static void processImage​(ImageData image)
        Process the passed Image data as a JPEG image. Image is loaded and all image attributes are initialized and/or updated.
        Parameters:
        image - the image to process as a JPEG image
      • attemptToSetIccProfileToImage

        static void attemptToSetIccProfileToImage​(byte[][] icc,
                                                  ImageData image)
      • updateAttributes

        private static void updateAttributes​(ImageData image)
      • processParameters

        private static void processParameters​(java.io.InputStream jpegStream,
                                              java.lang.String errorID,
                                              ImageData image)
                                       throws java.io.IOException
        This method checks if the image is a valid JPEG and processes some parameters.
        Throws:
        IOException
        java.io.IOException
      • getShort

        private static int getShort​(java.io.InputStream jpegStream)
                             throws java.io.IOException
        Reads a short from the InputStream.
        Parameters:
        jpegStream - the InputStream
        Returns:
        an int
        Throws:
        java.io.IOException
      • marker

        private static int marker​(int marker)
        Returns a type of marker.
        Parameters:
        marker - an int
        Returns:
        a type: VALID_MARKER, UNSUPPORTED_MARKER or NOPARAM_MARKER