src/share/classes/javax/imageio/ImageReader.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:


 274      * @param seekForwardOnly if <code>true</code>, images and metadata
 275      * may only be read in ascending order from this input source.
 276      * @param ignoreMetadata if <code>true</code>, metadata
 277      * may be ignored during reads.
 278      *
 279      * @exception IllegalArgumentException if <code>input</code> is
 280      * not an instance of one of the classes returned by the
 281      * originating service provider's <code>getInputTypes</code>
 282      * method, or is not an <code>ImageInputStream</code>.
 283      *
 284      * @see ImageInputStream
 285      * @see #getInput
 286      * @see javax.imageio.spi.ImageReaderSpi#getInputTypes
 287      */
 288     public void setInput(Object input,
 289                          boolean seekForwardOnly,
 290                          boolean ignoreMetadata) {
 291         if (input != null) {
 292             boolean found = false;
 293             if (originatingProvider != null) {
 294                 Class[] classes = originatingProvider.getInputTypes();
 295                 for (int i = 0; i < classes.length; i++) {
 296                     if (classes[i].isInstance(input)) {
 297                         found = true;
 298                         break;
 299                     }
 300                 }
 301             } else {
 302                 if (input instanceof ImageInputStream) {
 303                     found = true;
 304                 }
 305             }
 306             if (!found) {
 307                 throw new IllegalArgumentException("Incorrect input type!");
 308             }
 309 
 310             this.seekForwardOnly = seekForwardOnly;
 311             this.ignoreMetadata = ignoreMetadata;
 312             this.minIndex = 0;
 313         }
 314 




 274      * @param seekForwardOnly if <code>true</code>, images and metadata
 275      * may only be read in ascending order from this input source.
 276      * @param ignoreMetadata if <code>true</code>, metadata
 277      * may be ignored during reads.
 278      *
 279      * @exception IllegalArgumentException if <code>input</code> is
 280      * not an instance of one of the classes returned by the
 281      * originating service provider's <code>getInputTypes</code>
 282      * method, or is not an <code>ImageInputStream</code>.
 283      *
 284      * @see ImageInputStream
 285      * @see #getInput
 286      * @see javax.imageio.spi.ImageReaderSpi#getInputTypes
 287      */
 288     public void setInput(Object input,
 289                          boolean seekForwardOnly,
 290                          boolean ignoreMetadata) {
 291         if (input != null) {
 292             boolean found = false;
 293             if (originatingProvider != null) {
 294                 Class<?>[] classes = originatingProvider.getInputTypes();
 295                 for (int i = 0; i < classes.length; i++) {
 296                     if (classes[i].isInstance(input)) {
 297                         found = true;
 298                         break;
 299                     }
 300                 }
 301             } else {
 302                 if (input instanceof ImageInputStream) {
 303                     found = true;
 304                 }
 305             }
 306             if (!found) {
 307                 throw new IllegalArgumentException("Incorrect input type!");
 308             }
 309 
 310             this.seekForwardOnly = seekForwardOnly;
 311             this.ignoreMetadata = ignoreMetadata;
 312             this.minIndex = 0;
 313         }
 314