io

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 8 Imported by: 2

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

(AI GENERATED DESCRIPTION): Continuously reads TLV‑encoded packets from an io.Reader, buffering partial data and invoking a callback for each complete frame while handling errors and optional early termination.

Types

type TimedWriter

type TimedWriter struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

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

(AI GENERATED DESCRIPTION): Creates a TimedWriter that wraps the supplied io.Writer in a buffered writer of the given size and initializes it with a 1‑millisecond deadline and a maximum flush queue of 8.

func (*TimedWriter) Flush

func (w *TimedWriter) Flush() error

(AI GENERATED DESCRIPTION): Flush acquires the TimedWriter’s mutex, invokes its internal flush routine, and returns any error that occurs.

func (*TimedWriter) SetDeadline

func (w *TimedWriter) SetDeadline(d time.Duration)

(AI GENERATED DESCRIPTION): Sets the deadline duration that the TimedWriter will use for its timed operations.

func (*TimedWriter) SetMaxQueue

func (w *TimedWriter) SetMaxQueue(s int)

(AI GENERATED DESCRIPTION): Sets the maximum number of packets the TimedWriter can buffer in its internal queue.

func (*TimedWriter) Write

func (w *TimedWriter) Write(p []byte) (n int, err error)

(AI GENERATED DESCRIPTION): Writes data to the underlying writer, buffering until the queued size reaches the maximum or the deadline expires, then flushes the buffer (or returns any stored previous error) while ensuring thread‑safety.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL