Fix loading of inline JPEG images

This is a tentative patch to fix loading of inline JPEG images, based on this paragraph: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#page=223&zoom=auto,0,600.

Fixes #2812.
Fixes #4776.
Fixes [bug 1065245](https://bugzilla.mozilla.org/show_bug.cgi?id=1065245)

Also fixes missing images in (but the text is still incorrect):
#2840.
#4054.
there are more than three implementation of abstract Stream class, peekByte will be a big effort for this PR