Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmallsql <smallsql>2009-12-30 12:52:08 +0300
committersmallsql <smallsql>2009-12-30 12:52:08 +0300
commit3fd3c672146f8db0b831298d3b905f2959b5cc85 (patch)
treee675fda2ec67658aaa9cdfef33645a28d7668c8c /openjdk/com
parent3c57ded8b898a9d617dac7e99239b1a5905ec624 (diff)
fire IIORead events to the listeners
Diffstat (limited to 'openjdk/com')
-rw-r--r--openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReader.java39
1 files changed, 25 insertions, 14 deletions
diff --git a/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
index 48b04260..86dbe396 100644
--- a/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+++ b/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
@@ -110,21 +110,32 @@ class JPEGImageReader extends ImageReader{
if(image == null){
ImageInputStream iis = (ImageInputStream)getInput();
byte[] buffer;
- if( iis.length() >0){
- //If length known then it it is simple
- buffer = new byte[(int)iis.length()];
- iis.readFully(buffer);
- }else{
- // if the length not known then we need to read it in a loop
- ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
- buffer = new byte[8192];
- int count;
- while((count = iis.read(buffer)) > 0){
- baos.write(buffer, 0, count);
- }
- buffer = baos.toByteArray();
- }
+ try {
+ if( iis.length() >0){
+ //If length known then it it is simple
+ buffer = new byte[(int)iis.length()];
+ iis.readFully(buffer);
+ }else{
+ // if the length not known then we need to read it in a loop
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
+ buffer = new byte[8192];
+ int count;
+ while((count = iis.read(buffer)) > 0){
+ baos.write(buffer, 0, count);
+ }
+ buffer = baos.toByteArray();
+ }
+ } catch (IOException ioex) {
+ processReadAborted();
+ throw ioex;
+ }
+ processImageStarted(0);
image = (BufferedImage)Toolkit.getDefaultToolkit().createImage(buffer);
+ processPassStarted(image, 0, 0, 1, 0, 0, 1, 1, new int[0]);
+ processImageProgress(100.0F);
+ processImageUpdate(image, 0, 0, 0, 0, 1, 1, new int[0]);
+ processPassComplete(image);
+ processImageComplete();
}
return image;
}