where readTimeoutSum = readTimeout + readTimeoutMult * dataBuffer.length;
if canReturn is:
CanRead.allOrNothing
if (readedData.length < dataBuffer.length)
throwTimeoutException(port);
elsereturnreadedData;
CanReturn.anyNonZero
if (readedData.length == 0)
throwTimeoutException(port);
elsereturnreadedData;
CanReturn.zero
returnreadedData;
Params:
buf = preallocated buffer for reading
cr = flag what define behavior if readedData.length < buf.length
then readTimeoutSum is expires
Returns: slice of buf with readed data
Throws:
PortClosedException if port closed
ReadException if read error occurs
TimeoutException if timeout expires
Read data from port
Receive data time schema:
where readTimeoutSum = readTimeout + readTimeoutMult * dataBuffer.length;
if canReturn is:
CanRead.allOrNothing
CanReturn.anyNonZero
CanReturn.zero
Params: buf = preallocated buffer for reading cr = flag what define behavior if readedData.length < buf.length then readTimeoutSum is expires
Returns: slice of buf with readed data Throws: PortClosedException if port closed ReadException if read error occurs TimeoutException if timeout expires