Name
SPVM::Go::UV::Handle::Stream - Stream Handle for libuv
Description
Go::UV::Handle::Stream in SPVM represents the stream handle for libuv, corresponding to the uv_stream_t structure.
Super Class
Usage
use Go::UV::Handle::Stream;
Fields
read_cb
has read_cb : rw Go::UV::Callback::Read;
The callback called when data has been read from the stream.
read_buffer
has read_buffer : rw mutable string;
The buffer associated with the read operation.
read_buffer_length
has read_buffer_length : rw int;
The length of the read buffer.
read_buffer_offset
has read_buffer_offset : rw int;
The offset of the read buffer.
Instance Methods
read_start
method read_start : void ($buffer : mutable string, $buffer_length : int, $cb : Go::UV::Callback::Read, $buffer_offset : int = 0);
Starts reading data into $buffer with length $buffer_length and offset $buffer_offset from the stream.
The callback $cb is stored in "read_cb" field. The buffer $buffer is stored in "read_buffer" field. The length $buffer_length is stored in "read_buffer_length" field. The offset $buffer_offset is stored in "read_buffer_offset" field.
The callback $cb is invoked when data has been read from the stream.
This method calls the uv_read_start function internally.
Exceptions:
If $buffer is not defined, an exception is thrown.
If $buffer_length is not a positive number, an exception is thrown.
If $buffer_offset + $buffer_length is greater than the length of $buffer, an exception is thrown.
If $cb is not defined, an exception is thrown.
If uv_read_start> fails, an exception is thrown.
Copyright & License
Copyright (c) 2026 Yuki Kimoto
MIT License