question: @ Override public void loadRGBA ( Raster raster ) throws IOException { if ( bandStorageType == null ) { throw new IllegalArgumentException ( "Unable to find BAND_STORAGE_TYPE." ) ; } if ( samplesPerPixel < 3 ) { throw new IllegalArgumentException ( "Cannot load RGBA with less than 3 color components." ) ; } if ( iStream != null ) { iStream . close ( ) ; } iStream = new FileImageInputStream ( new File ( dataFilePath ) ) ; iStream . seek ( imageStart ) ; int stripHeight = Math . min ( STRIP_ROWS , rasterLength ) ; int stripWidth = rasterWidth * samplesPerPixel ; int numStrips = ( int ) Math . ceil ( ( double ) rasterLength / stripHeight ) ; if ( bandStorageType . equals ( "SAMPLE_INTERLEAVED" ) ) { int stripSize = stripWidth * stripHeight * bytesPerSample ; if ( stripSize > Integer . MAX_VALUE ) { throw new IllegalArgumentException ( "Cannot load PDS file with strip size > " + Integer . MAX_VALUE + "." ) ; } byte [ ] bbArray = new byte [ stripSize ] ; ByteBuffer bbuf = ByteBuffer . allocate ( 4 * rasterWidth * stripHeight ) ; iStream . seek ( imageStart ) ; int r = 0 ; for ( int i = 0 ; i < numStrips ; ++ i ) { int h = Math . min ( rasterLength - stripHeight * i , stripHeight ) ; int len = h * stripWidth ; len = iStream . read ( bbArray , 0 , len ) ; for ( int j = 0 ; j < h ; ++ j ) { for ( int k = 0 ; k < stripWidth ; k += samplesPerPixel ) { for ( int l = 0 ; l < samplesPerPixel ; ++ l ) { bbuf . put ( bbArray [ k + l ] ) ; } if ( samplesPerPixel == 3 ) { bbuf . put ( ( byte ) 255 ) ; } } r ++ ; } bbuf . rewind ( ) ; raster . set ( r , h , bbArray ) ; } } else if ( bandStorageType . equals ( "BAND_SEQUENTIAL" ) ) { int stripSize = rasterWidth * stripHeight ; if ( stripSize > Integer . MAX_VALUE ) { throw new IllegalArgumentException ( "Cannot load PDS file with strip size > " + Integer . MAX_VALUE + "." ) ; } raster . set ( 255 ) ; byte [ ] bArray = new byte [ 4 * rasterWidth * stripHeight ] ; byte [ ] bbArray = new byte [ stripSize ] ; iStream . seek ( imageStart ) ; for ( int k = 0 ; k < samplesPerPixel ; ++ k ) { int r = 0 ; for ( int i = 0 ; i < numStrips ; ++ i ) { int h = Math . min ( rasterLength - stripHeight * i , stripHeight ) ; int len = h * rasterWidth ; len = iStream . read ( bbArray , 0 , len ) ; for ( int j = 0 ; j < h ; ++ j ) { raster . get ( r , bArray ) ; for ( int c = 0 ; c < rasterWidth ; ++ c ) { bArray [ c * 4 + k ] = bbArray [ c ] ; } raster . set ( r , 1 , bArray ) ; r ++ ; } } } } if ( minimum == null ) { minimum = new double [ ] { 0 , 0 , 0 , 1 } ; } if ( maximum == null ) { maximum = new double [ ] { 255 , 255 , 255 , 255 } ; } }
target:  Load data from a file as an RGBA image, to be used as a texture map.