THausherr commented on code in PR #497:
URL: https://github.com/apache/pdfbox/pull/497#discussion_r3798375327
##########
pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/JPEGFactory.java:
##########
@@ -80,25 +81,13 @@ private JPEGFactory()
public static PDImageXObject createFromStream(PDDocument document,
InputStream stream)
throws IOException
{
- return createFromByteArray(document, stream.readAllBytes());
- }
-
- /**
- * Creates a new JPEG Image XObject from a byte array containing JPEG data.
- *
- * @param document the document where the image will be created
- * @param byteArray bytes of JPEG image
- * @return a new Image XObject
- *
- * @throws IOException if the input stream cannot be read
- */
- public static PDImageXObject createFromByteArray(PDDocument document,
byte[] byteArray)
- throws IOException
- {
- // copy stream
- ByteArrayInputStream byteStream = new ByteArrayInputStream(byteArray);
+ if (!(stream instanceof ByteArrayInputStream) && !(stream instanceof
BufferedInputStream))
Review Comment:
```suggestion
if (!stream.markSupported())
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]