src/share/classes/javax/imageio/ImageWriter.java

Print this page
rev 9344 : 8034998: Fix raw and unchecked lint warnings in javax.imageio
Reviewed-by: darcy, prr
rev 9345 : 8035487: Fix raw and unchecked lint warnings in javax.imageio.spi
Reviewed-by:


 188      *
 189      * <p> The default implementation sets the <code>output</code>
 190      * instance variable to the value of <code>output</code> after
 191      * checking <code>output</code> against the set of classes
 192      * advertised by the originating provider, if there is one.
 193      *
 194      * @param output the <code>ImageOutputStream</code> or other
 195      * <code>Object</code> to use for future writing.
 196      *
 197      * @exception IllegalArgumentException if <code>output</code> is
 198      * not an instance of one of the classes returned by the
 199      * originating service provider's <code>getOutputTypes</code>
 200      * method.
 201      *
 202      * @see #getOutput
 203      */
 204     public void setOutput(Object output) {
 205         if (output != null) {
 206             ImageWriterSpi provider = getOriginatingProvider();
 207             if (provider != null) {
 208                 Class[] classes = provider.getOutputTypes();
 209                 boolean found = false;
 210                 for (int i = 0; i < classes.length; i++) {
 211                     if (classes[i].isInstance(output)) {
 212                         found = true;
 213                         break;
 214                     }
 215                 }
 216                 if (!found) {
 217                     throw new IllegalArgumentException("Illegal output type!");
 218                 }
 219             }
 220         }
 221 
 222         this.output = output;
 223     }
 224 
 225     /**
 226      * Returns the <code>ImageOutputStream</code> or other
 227      * <code>Object</code> set by the most recent call to the
 228      * <code>setOutput</code> method.  If no destination has been




 188      *
 189      * <p> The default implementation sets the <code>output</code>
 190      * instance variable to the value of <code>output</code> after
 191      * checking <code>output</code> against the set of classes
 192      * advertised by the originating provider, if there is one.
 193      *
 194      * @param output the <code>ImageOutputStream</code> or other
 195      * <code>Object</code> to use for future writing.
 196      *
 197      * @exception IllegalArgumentException if <code>output</code> is
 198      * not an instance of one of the classes returned by the
 199      * originating service provider's <code>getOutputTypes</code>
 200      * method.
 201      *
 202      * @see #getOutput
 203      */
 204     public void setOutput(Object output) {
 205         if (output != null) {
 206             ImageWriterSpi provider = getOriginatingProvider();
 207             if (provider != null) {
 208                 Class<?>[] classes = provider.getOutputTypes();
 209                 boolean found = false;
 210                 for (int i = 0; i < classes.length; i++) {
 211                     if (classes[i].isInstance(output)) {
 212                         found = true;
 213                         break;
 214                     }
 215                 }
 216                 if (!found) {
 217                     throw new IllegalArgumentException("Illegal output type!");
 218                 }
 219             }
 220         }
 221 
 222         this.output = output;
 223     }
 224 
 225     /**
 226      * Returns the <code>ImageOutputStream</code> or other
 227      * <code>Object</code> set by the most recent call to the
 228      * <code>setOutput</code> method.  If no destination has been