iokit

package
v0.166.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ErrSeekNegativePosition errorkit.Error = "iokit: negative position"

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer is an in-memory io.ReadWriteSeeker implementation

func NewBuffer

func NewBuffer[T []byte | string](data T) *Buffer

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

func (*Buffer) Close

func (b *Buffer) Close() error

func (*Buffer) Read

func (b *Buffer) Read(p []byte) (n int, err error)

func (*Buffer) Seek

func (b *Buffer) Seek(offset int64, whence int) (int64, error)

Seek seeks in the buffer of this Buffer instance

func (*Buffer) String

func (b *Buffer) String() string

func (*Buffer) Write

func (b *Buffer) Write(p []byte) (n int, err error)

Write writes to the buffer of this Buffer instance

type SyncReadWriter added in v0.147.0

type SyncReadWriter struct {
	// ReadWriter is the protected io.ReadWriter
	ReadWriter io.ReadWriter
	// Locker is an optional sync.Locker value if you need to share locking between different multiple SyncReader.
	//
	// Default: sync.Mutex
	Locker sync.Locker
}

func (*SyncReadWriter) Read added in v0.147.0

func (rw *SyncReadWriter) Read(p []byte) (n int, err error)

func (*SyncReadWriter) Write added in v0.147.0

func (rw *SyncReadWriter) Write(p []byte) (n int, err error)

type SyncReader added in v0.147.0

type SyncReader struct {
	// Reader is the protected io.Reader
	Reader io.Reader
	// Locker is an optional sync.Locker value if you need to share locking between different multiple SyncReader.
	//
	// Default: sync.Mutex
	Locker sync.Locker
}

func (*SyncReader) Read added in v0.147.0

func (r *SyncReader) Read(p []byte) (n int, err error)

type SyncWriter

type SyncWriter struct {
	// Writer is the protected io.Writer
	Writer io.Writer
	// Locker is an optional sync.Locker value if you need to share locking between different multiple SyncWriter.
	//
	// Default: sync.Mutex
	Locker sync.Locker
}

func (*SyncWriter) Write

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

Jump to

Keyboard shortcuts

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