Reads at least min but no more than max bytes from the input to a new byte array
if not enough bytes available to get min bytes