question: @ Override public void loadRGBA ( Raster raster ) { if ( isTiled ( ) ) { int n = getTileCount ( ) ; int w = getTileWidth ( ) ; int h = getTileLength ( ) ; long s = getTileSize ( ) ; if ( s > Integer . MAX_VALUE ) { throw new IllegalArgumentException ( "Cannot load TIFF file with tile size > " + Integer . MAX_VALUE + "." ) ; } ByteBuffer bbuf = ByteBuffer . allocateDirect ( ( int ) s ) ; bbuf . order ( byteOrder ) ; byte [ ] bArray = new byte [ ( int ) s ] ; int r = 0 , c = 0 ; for ( int i = 0 ; i < n ; ++ i ) { boolean success = readRGBATile ( handle , r , c , bbuf ) ; if ( ! success ) { throw new IllegalStateException ( getTIFFError ( ) ) ; } bbuf . rewind ( ) ; bbuf . get ( bArray ) ; int wid = Math . min ( w , rasterWidth - c ) ; int hgt = Math . min ( h , rasterLength - r ) ; raster . set ( r , c , wid , hgt , bArray ) ; c += w ; if ( c >= rasterWidth ) { c = 0 ; r += h ; } Thread . yield ( ) ; } } else { int n = getStripCount ( ) ; int h = getRowsPerStrip ( ) ; int s = rasterWidth * h * 4 ; if ( s > Integer . MAX_VALUE ) { throw new IllegalArgumentException ( "Cannot load TIFF file with strip size > " + Integer . MAX_VALUE + "." ) ; } ByteBuffer bbuf = ByteBuffer . allocateDirect ( s ) ; bbuf . order ( byteOrder ) ; byte [ ] bArray = new byte [ s ] ; bbuf . rewind ( ) ; int r = 0 ; for ( int i = 0 ; i < n ; ++ i ) { boolean success = readRGBAStrip ( handle , r , bbuf ) ; if ( ! success ) { throw new IllegalStateException ( getTIFFError ( ) ) ; } bbuf . rewind ( ) ; if ( samplesPerPixel == 4 ) ImageUtil . doFlip ( bbuf , rasterWidth * 4 , h ) ; bbuf . get ( bArray ) ; int hgt = Math . min ( h , rasterLength - r ) ; raster . set ( r , hgt , bArray ) ; r += h ; Thread . yield ( ) ; } } if ( minimum == null ) { minimum = new double [ ] { 0 , 0 , 0 , 1 } ; } if ( maximum == null ) { maximum = new double [ ] { 255 , 255 , 255 , 255 } ; } }
target:  Load entire file contents into byte array. File data type must be short, unsigned short, byte, or unsigned byte.