read whole data at once instead of byte by byte