Skip to content

Commit 5db1843

Browse files
HannesWellakurtakov
authored andcommitted
Use InputStream.readAllBytes() in ImageLoader for GTK
1 parent e4a4d28 commit 5db1843

File tree

1 file changed

+1
-4
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics

1 file changed

+1
-4
lines changed

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/ImageLoader.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,7 @@ boolean isInterlacedPNG(byte [] imageAsByteArray) {
180180
List<ImageData> imgDataList = new ArrayList<>();
181181
try {
182182
// 1) Load InputStream into byte array
183-
ByteArrayOutputStream baos = new ByteArrayOutputStream();
184-
stream.transferTo(baos);
185-
baos.flush();
186-
byte[] data_buffer = baos.toByteArray();
183+
byte[] data_buffer = stream.readAllBytes();
187184
if (data_buffer.length == 0) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT); // empty stream
188185

189186
// 2) Copy byte array to C memory, write to GdkPixbufLoader

0 commit comments

Comments
 (0)