277 * @see #getDestinationBands 278 * @see #getSourceBands 279 * @see ImageReader#checkReadParamBandSettings 280 */ 281 public void setDestinationBands(int[] destinationBands) { 282 if (destinationBands == null) { 283 this.destinationBands = null; 284 } else { 285 int numBands = destinationBands.length; 286 for (int i = 0; i < numBands; i++) { 287 int band = destinationBands[i]; 288 if (band < 0) { 289 throw new IllegalArgumentException("Band value < 0!"); 290 } 291 for (int j = i + 1; j < numBands; j++) { 292 if (band == destinationBands[j]) { 293 throw new IllegalArgumentException("Duplicate band value!"); 294 } 295 } 296 } 297 this.destinationBands = (int[])destinationBands.clone(); 298 } 299 } 300 301 /** 302 * Returns the set of band indices where data will be placed. 303 * If no value has been set, <code>null</code> is returned to 304 * indicate that all destination bands will be used. 305 * 306 * @return the indices of the destination bands to be used, 307 * or <code>null</code>. 308 * 309 * @see #setDestinationBands 310 */ 311 public int[] getDestinationBands() { 312 if (destinationBands == null) { 313 return null; 314 } else { 315 return (int[])(destinationBands.clone()); 316 } 317 } 318 319 /** 320 * Returns <code>true</code> if this reader allows the source 321 * image to be rendered at an arbitrary size as part of the 322 * decoding process, by means of the 323 * <code>setSourceRenderSize</code> method. If this method 324 * returns <code>false</code>, calls to 325 * <code>setSourceRenderSize</code> will throw an 326 * <code>UnsupportedOperationException</code>. 327 * 328 * @return <code>true</code> if setting source rendering size is 329 * supported. 330 * 331 * @see #setSourceRenderSize 332 */ 333 public boolean canSetSourceRenderSize() { 334 return canSetSourceRenderSize; 335 } | 277 * @see #getDestinationBands 278 * @see #getSourceBands 279 * @see ImageReader#checkReadParamBandSettings 280 */ 281 public void setDestinationBands(int[] destinationBands) { 282 if (destinationBands == null) { 283 this.destinationBands = null; 284 } else { 285 int numBands = destinationBands.length; 286 for (int i = 0; i < numBands; i++) { 287 int band = destinationBands[i]; 288 if (band < 0) { 289 throw new IllegalArgumentException("Band value < 0!"); 290 } 291 for (int j = i + 1; j < numBands; j++) { 292 if (band == destinationBands[j]) { 293 throw new IllegalArgumentException("Duplicate band value!"); 294 } 295 } 296 } 297 this.destinationBands = destinationBands.clone(); 298 } 299 } 300 301 /** 302 * Returns the set of band indices where data will be placed. 303 * If no value has been set, <code>null</code> is returned to 304 * indicate that all destination bands will be used. 305 * 306 * @return the indices of the destination bands to be used, 307 * or <code>null</code>. 308 * 309 * @see #setDestinationBands 310 */ 311 public int[] getDestinationBands() { 312 if (destinationBands == null) { 313 return null; 314 } else { 315 return destinationBands.clone(); 316 } 317 } 318 319 /** 320 * Returns <code>true</code> if this reader allows the source 321 * image to be rendered at an arbitrary size as part of the 322 * decoding process, by means of the 323 * <code>setSourceRenderSize</code> method. If this method 324 * returns <code>false</code>, calls to 325 * <code>setSourceRenderSize</code> will throw an 326 * <code>UnsupportedOperationException</code>. 327 * 328 * @return <code>true</code> if setting source rendering size is 329 * supported. 330 * 331 * @see #setSourceRenderSize 332 */ 333 public boolean canSetSourceRenderSize() { 334 return canSetSourceRenderSize; 335 } |