jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java
changeset 40137 0d7d50ab241f
parent 36448 a07e108d5722
child 40429 d873154f9975
equal deleted inserted replaced
40136:e1aeb5f5a777 40137:0d7d50ab241f
   261     public ImageWriteParam getDefaultWriteParam() {
   261     public ImageWriteParam getDefaultWriteParam() {
   262         return new TIFFImageWriteParam(getLocale());
   262         return new TIFFImageWriteParam(getLocale());
   263     }
   263     }
   264 
   264 
   265     public void setOutput(Object output) {
   265     public void setOutput(Object output) {
   266         super.setOutput(output);
       
   267 
       
   268         if (output != null) {
   266         if (output != null) {
   269             reset();
       
   270 
       
   271             if (!(output instanceof ImageOutputStream)) {
   267             if (!(output instanceof ImageOutputStream)) {
   272                 throw new IllegalArgumentException
   268                 throw new IllegalArgumentException
   273                     ("output not an ImageOutputStream!");
   269                     ("output not an ImageOutputStream!");
   274             }
   270             }
       
   271 
       
   272             // reset() must precede setOutput() as it sets output to null
       
   273             reset();
       
   274 
   275             this.stream = (ImageOutputStream)output;
   275             this.stream = (ImageOutputStream)output;
   276 
   276 
   277             //
   277             //
   278             // The output is expected to be positioned at a TIFF header
   278             // The output is expected to be positioned at a TIFF header
   279             // or at some arbitrary location which may or may not be
   279             // or at some arbitrary location which may or may not be
   310                 this.nextSpace = headerPosition = 0L;
   310                 this.nextSpace = headerPosition = 0L;
   311             }
   311             }
   312         } else {
   312         } else {
   313             this.stream = null;
   313             this.stream = null;
   314         }
   314         }
       
   315 
       
   316         super.setOutput(output);
   315     }
   317     }
   316 
   318 
   317     public IIOMetadata
   319     public IIOMetadata
   318         getDefaultStreamMetadata(ImageWriteParam param) {
   320         getDefaultStreamMetadata(ImageWriteParam param) {
   319         return new TIFFStreamMetadata();
   321         return new TIFFStreamMetadata();