readAtMost
Reads at most len bytes from the data source starting at the given pos into the buf array, starting at offset off.
This function attempts to read up to len bytes into the buffer. Fewer bytes may be read only if the end of the data is reached. This method never blocks indefinitely.
Return
The number of bytes actually read, or 0 if the end of data is reached
Parameters
pos
The starting position in the data source (must be ≥ 0; values beyond data size are treated as EOF)
buf
The destination byte array
off
The starting offset in the buffer (must be in [0, buf.size))
len
The maximum number of bytes to read (must be in 0, buf.size - off)
Throws
If an I/O error occurs (for file/network-backed implementations)