io

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

View Source
const (
	BytesOpSize  = 1 + bytesSize
	StringOpSize = 1 + stringSize
)

Variables

View Source
var ErrLimit = errors.New("read reached limit")

Functions

func HandleRecovery

func HandleRecovery(e any) error

func ReadAllLimit

func ReadAllLimit(r io.Reader, limit int) ([]byte, error)

func Write

func Write(w io.Writer, p []byte, np *int64) error

func WriteAndReset

func WriteAndReset(w *Writer, iow io.Writer, np *int64) error

func WriteAndResetPanic

func WriteAndResetPanic(w *Writer, iow io.Writer, np *int64)

func WritePanic

func WritePanic(w io.Writer, p []byte, np *int64)

func WriteString

func WriteString(w io.Writer, s string, np *int64) error

func WriteStringPanic

func WriteStringPanic(w io.Writer, s string, np *int64)

func WriteTo

func WriteTo(wt io.WriterTo, w io.Writer, np *int64) error

func WriteToPanic

func WriteToPanic(wt io.WriterTo, w io.Writer, np *int64)

Types

type Data

type Data interface {
	Bytes() []byte
}

type OpWriter

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

func NewOpWriter

func NewOpWriter(buf []byte) *OpWriter

func OpWriterAppendEmbedded

func OpWriterAppendEmbedded[T any](w *OpWriter, emb T) *OpWriter

func (*OpWriter) AppendByte

func (w *OpWriter) AppendByte(b byte) *OpWriter

func (*OpWriter) AppendBytes

func (w *OpWriter) AppendBytes(bs []byte) *OpWriter

func (*OpWriter) AppendEmbeddedBytes

func (w *OpWriter) AppendEmbeddedBytes(bs []byte) *OpWriter

func (*OpWriter) AppendEmbeddedString

func (w *OpWriter) AppendEmbeddedString(s string) *OpWriter

func (*OpWriter) AppendString

func (w *OpWriter) AppendString(s string) *OpWriter

func (*OpWriter) AppendUint16

func (w *OpWriter) AppendUint16(u uint16) *OpWriter

func (*OpWriter) AppendUint32

func (w *OpWriter) AppendUint32(u uint32) *OpWriter

func (*OpWriter) AppendUint64

func (w *OpWriter) AppendUint64(u uint64) *OpWriter

func (*OpWriter) AppendWriter

func (w *OpWriter) AppendWriter(writer io.WriterTo, size int) *OpWriter

func (*OpWriter) Bytes

func (w *OpWriter) Bytes() []byte

func (*OpWriter) Clear

func (w *OpWriter) Clear()

func (*OpWriter) Read

func (w *OpWriter) Read(p []byte) (n int, err error)

func (*OpWriter) Reset

func (w *OpWriter) Reset()

func (*OpWriter) SetBuf

func (w *OpWriter) SetBuf(buf []byte) *OpWriter

func (*OpWriter) Size

func (w *OpWriter) Size() int

func (*OpWriter) WriteTo

func (w *OpWriter) WriteTo(_w io.Writer) (n int64, err error)

type Writer

type Writer struct {
	Buf []byte
	// contains filtered or unexported fields
}

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

func (*Writer) Len

func (w *Writer) Len() int

func (*Writer) Remain

func (w *Writer) Remain() int

func (*Writer) Reset

func (w *Writer) Reset()

func (*Writer) ResetBuf

func (w *Writer) ResetBuf(buf []byte)

func (*Writer) Write

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

func (*Writer) WriteByte

func (w *Writer) WriteByte(b byte) *Writer

func (*Writer) WriteBytes

func (w *Writer) WriteBytes(p []byte) (n int)

func (*Writer) WriteBytesAnd

func (w *Writer) WriteBytesAnd(p []byte) *Writer

func (*Writer) WriteLittleUint16

func (w *Writer) WriteLittleUint16(u uint16) *Writer

func (*Writer) WriteLittleUint32

func (w *Writer) WriteLittleUint32(u uint32) *Writer

func (*Writer) WriteLittleUint64

func (w *Writer) WriteLittleUint64(u uint64) *Writer

func (*Writer) WriteString

func (w *Writer) WriteString(s string) (n int)

func (*Writer) WriteStringAnd

func (w *Writer) WriteStringAnd(s string) *Writer

func (*Writer) WriteUint16

func (w *Writer) WriteUint16(u uint16) *Writer

func (*Writer) WriteUint32

func (w *Writer) WriteUint32(u uint32) *Writer

func (*Writer) WriteUint64

func (w *Writer) WriteUint64(u uint64) *Writer

func (*Writer) WriterTo

func (w *Writer) WriterTo(wt io.Writer, np *int64) error

func (*Writer) WriterToAndReset

func (w *Writer) WriterToAndReset(wt io.Writer, np *int64) error

Jump to

Keyboard shortcuts

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