Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadTlvStream ¶
func ReadTlvStream( reader io.Reader, onFrame func([]byte) bool, ignoreError func(error) bool, ) error
Reads a TLV-encoded stream from the given reader, processes each complete TLV block via the onFrame callback, and handles errors using the ignoreError callback until EOF or an unignorable error occurs.
Types ¶
type TimedWriter ¶
TimedWriter is a buffered writer that flushes automatically when a deadline is set and the deadline is exceeded.
func NewTimedWriter ¶
func NewTimedWriter(io io.Writer, bufsize int) *TimedWriter
Constructs a `TimedWriter` with the provided `io.Writer` and buffer size, initialized with a default write deadline of 1 millisecond and a maximum queue size of 8.
func (*TimedWriter) Flush ¶
func (w *TimedWriter) Flush() error
Safely flushes any buffered data from the TimedWriter by acquiring a mutex lock before invoking the internal flush operation, returning any resulting errors.
func (*TimedWriter) SetDeadline ¶
func (w *TimedWriter) SetDeadline(d time.Duration)
Sets the deadline for the TimedWriter to the specified duration, determining the maximum time allowed for write operations.
func (*TimedWriter) SetMaxQueue ¶
func (w *TimedWriter) SetMaxQueue(s int)
Sets the maximum queue size for the TimedWriter to the specified integer value, ensuring thread-safe updates with a mutex lock.