Skip to content

Commit 5829a66

Browse files
Andrew BryginRealCLanger
authored andcommitted
8278805: Enhance BMP image loading
Backport-of: 6319119be51e595be82f253b9f5e9495e72d4ad9
1 parent 09e3031 commit 5829a66

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767

6868
import com.sun.imageio.plugins.common.I18N;
6969
import com.sun.imageio.plugins.common.ImageUtil;
70+
import com.sun.imageio.plugins.common.ReaderUtil;
7071

7172
/** This class is the Java Image IO plugin reader for BMP images.
7273
* It may subsample the image, clip the image, select sub-bands,
@@ -1542,9 +1543,8 @@ private void readRLE8(byte[] bdata) throws IOException {
15421543
}
15431544

15441545
// Read till we have the whole image
1545-
byte[] values = new byte[imSize];
1546-
int bytesRead = 0;
1547-
iis.readFully(values, 0, imSize);
1546+
byte[] values = ReaderUtil.
1547+
staggeredReadByteStream(iis, imSize);
15481548

15491549
// Since data is compressed, decompress it
15501550
decodeRLE8(imSize, padding, values, bdata);
@@ -1726,8 +1726,8 @@ private void readRLE4(byte[] bdata) throws IOException {
17261726
}
17271727

17281728
// Read till we have the whole image
1729-
byte[] values = new byte[imSize];
1730-
iis.readFully(values, 0, imSize);
1729+
byte[] values = ReaderUtil.
1730+
staggeredReadByteStream(iis, imSize);
17311731

17321732
// Decompress the RLE4 compressed data.
17331733
decodeRLE4(imSize, padding, values, bdata);

0 commit comments

Comments
 (0)