diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/ImageLoader.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/ImageLoader.java index 89b97cd86e6..4fbda1029d7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/ImageLoader.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/ImageLoader.java @@ -180,10 +180,7 @@ boolean isInterlacedPNG(byte [] imageAsByteArray) { List imgDataList = new ArrayList<>(); try { // 1) Load InputStream into byte array - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - stream.transferTo(baos); - baos.flush(); - byte[] data_buffer = baos.toByteArray(); + byte[] data_buffer = stream.readAllBytes(); if (data_buffer.length == 0) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT); // empty stream // 2) Copy byte array to C memory, write to GdkPixbufLoader