public boolean parseMoreData(final EncodedImage encodedImage) {
    if (mParserState == NOT_A_JPEG) {
      return false;
    }

    final int dataBufferSize = encodedImage.getSize();

    // Is there any new data to parse?
    // mBytesParsed might be greater than size of dataBuffer - that happens when
    // we skip more data than is available to read inside doParseMoreData method
    if (dataBufferSize <= mBytesParsed) {
      return false;
    }

    final InputStream bufferedDataStream =
        new PooledByteArrayBufferedInputStream(
            encodedImage.getInputStreamOrThrow(), mByteArrayPool.get(BUFFER_SIZE), mByteArrayPool);
    try {
      StreamUtil.skip(bufferedDataStream, mBytesParsed);
      return doParseMoreData(bufferedDataStream);
    } catch (IOException ioe) {
      // Does not happen - streams returned by PooledByteBuffers do not throw IOExceptions
      Throwables.propagate(ioe);
      return false;
    } finally {
      Closeables.closeQuietly(bufferedDataStream);
    }
  }
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.

<p>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.

@param encodedImage Next set of bytes received by the caller
@return true if a new full scan has been found
imagepipeline/src/main/java/com/facebook/imagepipeline/decoder/ProgressiveJpegParser.java