Package 

Class ProgressiveJpegParser


  • 
    public class ProgressiveJpegParser
    
                        

    Progressively scans jpeg data and instructs caller when enough data is available to decode a partial image.

    This class treats any sequence of bytes starting with 0xFFD8 as a valid jpeg image

    Users should call parseMoreData method each time new chunk of data is received. The buffer passed as a parameter should include entire image data received so far.

    • Constructor Summary

      Constructors 
      Constructor Description
      ProgressiveJpegParser(ByteArrayPool byteArrayPool)
    • Method Summary

      Modifier and Type Method Description
      boolean parseMoreData(EncodedImage encodedImage) If this is the first time calling this method, the buffer will be checked to make sure itstarts with SOI marker (0xffd8).
      boolean isJpeg()
      int getBestScanEndOffset()
      int getBestScanNumber()
      boolean isEndMarkerRead() Returns true if the end marker has been read.
      • Methods inherited from class java.lang.Object

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

      • ProgressiveJpegParser

        ProgressiveJpegParser(ByteArrayPool byteArrayPool)
    • Method Detail

      • parseMoreData

         boolean parseMoreData(EncodedImage encodedImage)

        If this is the first time calling this method, the buffer will be checked to make sure itstarts with SOI marker (0xffd8). If the image has been identified as a non-JPEG, data will beignored and false will be returned immediately on all subsequent calls.

        This object maintains state of the position of the last read byte. On repeated calls to thismethod, it will continue from where it left off.

        Parameters:
        encodedImage - Next set of bytes received by the caller
      • isEndMarkerRead

         boolean isEndMarkerRead()

        Returns true if the end marker has been read.