public class

ProgressiveJpegParser

extends Object
java.lang.Object
   ↳ com.facebook.imagepipeline.decoder.ProgressiveJpegParser

Class Overview

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.

Summary

Public Constructors
ProgressiveJpegParser(ByteArrayPool byteArrayPool)
Public Methods
int getBestScanEndOffset()
int getBestScanNumber()
boolean isEndMarkerRead()
Returns true if the end marker has been read.
boolean isJpeg()
boolean parseMoreData(EncodedImage encodedImage)
If this is the first time calling this method, the buffer will be checked to make sure it starts with SOI marker (0xffd8).
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ProgressiveJpegParser (ByteArrayPool byteArrayPool)

Public Methods

public int getBestScanEndOffset ()

Returns
  • offset at which parsed data should be cut to decode best available partial result

public int getBestScanNumber ()

Returns
  • number of the best scan found so far

public boolean isEndMarkerRead ()

Returns true if the end marker has been read.

public boolean isJpeg ()

public boolean parseMoreData (EncodedImage encodedImage)

If this is the first time calling this method, the buffer will be checked to make sure it starts with SOI marker (0xffd8). If the image has been identified as a non-JPEG, data will be ignored 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 this method, it will continue from where it left off.

Parameters
encodedImage Next set of bytes received by the caller
Returns
  • true if a new full scan has been found