bytes

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

func NewBuffer

func NewBuffer(b []byte) *Buffer

func (*Buffer) Break

func (b *Buffer) Break() *Buffer

Break breaks the for loop; DO NOT use this outside of For, or it may cause panic.

func (Buffer) Bytes

func (b Buffer) Bytes() []byte

Bytes returns b.data. It is NOT a copy, so the result will be changed after b modified.

func (Buffer) BytesCopy

func (b Buffer) BytesCopy() []byte

func (Buffer) Cap

func (b Buffer) Cap() int

func (*Buffer) Else

func (b *Buffer) Else() *Buffer

func (*Buffer) ElseIf

func (b *Buffer) ElseIf(cond bool) *Buffer

func (*Buffer) EndIf

func (b *Buffer) EndIf() *Buffer

func (*Buffer) For

func (b *Buffer) For(start, end, step int, do func(b *Buffer, i int)) *Buffer

For starts a for loop with the given start, end and step. Function do will be called for each step.

func (*Buffer) ForNTimes

func (b *Buffer) ForNTimes(n int, do func(b *Buffer, i int)) *Buffer

ForNTimes is a shortcut of For(0, n, 1, do); i would be 0, 1, 2, ..., n-1.

func (*Buffer) If

func (b *Buffer) If(cond bool) *Buffer

func (Buffer) Len

func (b Buffer) Len() int

func (Buffer) ReadCloser

func (b Buffer) ReadCloser() io.ReadCloser

ReadCloser creates an io.ReadCloser, but Close does nothing.

func (Buffer) Reader

func (b Buffer) Reader() io.Reader

Reader creates an io.Reader for Read.

func (*Buffer) Reset

func (b *Buffer) Reset()

func (Buffer) String

func (b Buffer) String() string

String implements Stringer.

func (*Buffer) Write

func (b *Buffer) Write(data []byte) (int, error)

Write implements io.Writer, and it will write data to buffer directly, without considering any conditions. If you need chaining call, use WriteBytes instead.

func (*Buffer) WriteAny

func (b *Buffer) WriteAny(v any) *Buffer

WriteAny writes any value to the buffer. DO NOT write byte or rune value with this if you want its ASCII representation. Use WriteByte or WriteRune instead.

func (*Buffer) WriteBool

func (b *Buffer) WriteBool(v bool) *Buffer

func (*Buffer) WriteByte

func (b *Buffer) WriteByte(c byte) *Buffer

func (*Buffer) WriteBytes

func (b *Buffer) WriteBytes(s []byte) *Buffer

func (*Buffer) WriteDuration

func (b *Buffer) WriteDuration(d time.Duration) *Buffer

func (*Buffer) WriteFloat32

func (b *Buffer) WriteFloat32(f float32, format byte, precision int) *Buffer

func (*Buffer) WriteFloat64

func (b *Buffer) WriteFloat64(f float64, format byte, precision int) *Buffer

func (*Buffer) WriteFromBufferWriter

func (b *Buffer) WriteFromBufferWriter(w BufferWriter) *Buffer

func (*Buffer) WriteInt

func (b *Buffer) WriteInt(i int) *Buffer

func (*Buffer) WriteInt16

func (b *Buffer) WriteInt16(i int16) *Buffer

func (*Buffer) WriteInt32

func (b *Buffer) WriteInt32(i int32) *Buffer

func (*Buffer) WriteInt64

func (b *Buffer) WriteInt64(i int64) *Buffer

func (*Buffer) WriteInt8

func (b *Buffer) WriteInt8(i int8) *Buffer

func (*Buffer) WriteJsonSafeBytes

func (b *Buffer) WriteJsonSafeBytes(s []byte) *Buffer

func (*Buffer) WriteJsonSafeString

func (b *Buffer) WriteJsonSafeString(s string) *Buffer

func (*Buffer) WritePointer

func (b *Buffer) WritePointer(p uintptr) *Buffer

WritePointer appends the hexadecimal address of p with a "0x" prefix. uintptr is like uint, its bitsize depends on the operating system.

func (*Buffer) WriteRune

func (b *Buffer) WriteRune(r rune) *Buffer

func (*Buffer) WriteString

func (b *Buffer) WriteString(s string) *Buffer

func (*Buffer) WriteTime

func (b *Buffer) WriteTime(t time.Time, format string) *Buffer

func (*Buffer) WriteUint

func (b *Buffer) WriteUint(i uint) *Buffer

func (*Buffer) WriteUint16

func (b *Buffer) WriteUint16(i uint16) *Buffer

func (*Buffer) WriteUint32

func (b *Buffer) WriteUint32(i uint32) *Buffer

func (*Buffer) WriteUint64

func (b *Buffer) WriteUint64(i uint64) *Buffer

func (*Buffer) WriteUint8

func (b *Buffer) WriteUint8(i uint8) *Buffer

type BufferWriteFunc

type BufferWriteFunc func(b *Buffer)

func (BufferWriteFunc) WriteTo

func (fn BufferWriteFunc) WriteTo(b *Buffer)

type BufferWriter

type BufferWriter interface {
	WriteTo(b *Buffer)
}

Jump to

Keyboard shortcuts

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