Read or write a block of data from/to a RasterBand. The data type of the buffer is automatically converted to that of the image file if necessary, and resampling is performed as necessary to match the buffer dimensions to the requested rectangle. The buffer is passed in as an array of bytes.