private int getReadAlignedLength ( long offset , int readLength ) { // Calculate how many bytes over the last alignment marker the offset is. int lengthSinceLastMultiple = ( int ) ( offset % this . config . getStorageReadAlignment ( ) ) ; // Even though we were asked to read a number of bytes, in some cases we will return fewer bytes than requested // in order to read-align the reads. return Math . min ( readLength , this . config . getStorageReadAlignment ( ) - lengthSinceLastMultiple ) ; }
Returns an adjusted read length based on the given input making sure the end of the Read Request is aligned with a multiple of STORAGE_READ_MAX_LEN .