jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
changeset 34792 9421752d717b
parent 25859 3317bb8137f4
child 35646 845a3ebfeb00
equal deleted inserted replaced
34791:ba6621e4e133 34792:9421752d717b
   191         stream.seek(startPos);
   191         stream.seek(startPos);
   192         stream.writeInt((int)(pos - startPos) - 12);
   192         stream.writeInt((int)(pos - startPos) - 12);
   193 
   193 
   194         // Return to end of chunk and flush to minimize buffering
   194         // Return to end of chunk and flush to minimize buffering
   195         stream.seek(pos);
   195         stream.seek(pos);
   196         stream.flushBefore(pos);
   196         try {
       
   197             stream.flushBefore(pos);
       
   198         } catch (IOException e) {
       
   199             /*
       
   200              * If flushBefore() fails we try to access startPos in finally
       
   201              * block of write_IDAT(). We should update startPos to avoid
       
   202              * IndexOutOfBoundException while seek() is happening.
       
   203              */
       
   204             this.startPos = stream.getStreamPosition();
       
   205             throw e;
       
   206         }
   197     }
   207     }
   198 
   208 
   199     public int read() throws IOException {
   209     public int read() throws IOException {
   200         throw new RuntimeException("Method not available");
   210         throw new RuntimeException("Method not available");
   201     }
   211     }