public boolean isCompleteAt(int length) {
    if (mImageFormat != DefaultImageFormats.JPEG && mImageFormat != DefaultImageFormats.DNG) {
      return true;
    }
    // If the image is backed by FileInputStreams return true since they will always be complete.
    if (mInputStreamSupplier != null) {
      return true;
    }
    // The image should be backed by a ByteBuffer
    Preconditions.checkNotNull(mPooledByteBufferRef);
    PooledByteBuffer buf = mPooledByteBufferRef.get();
    if (length < 2) {
      return false;
    }
    return (buf.read(length - 2) == (byte) JfifUtil.MARKER_FIRST_BYTE)
        && (buf.read(length - 1) == (byte) JfifUtil.MARKER_EOI);
  }
Returns true if the image is a JPEG or DNG and its data is already complete at the specified
length, false otherwise.
imagepipeline-base/src/main/java/com/facebook/imagepipeline/image/EncodedImage.java