bytes

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(b []byte) []byte

Copy возврашает копию среза b.

func Equal

func Equal(a, b []byte) bool

Equal проверяе, являются ли преданные срезы a и b эквивалентными.

func Extend

func Extend(b []byte, needLen int) []byte

Extend расширяет срез b до заданного размера.

func Prepend

func Prepend(dst []byte, src ...byte) []byte

Prepend добавляет src в переданный срез dst.

func PrependString

func PrependString(dst []byte, src string) []byte

PrependString добавляет строку в переданный байтовый срез dst.

func Rand

func Rand(dst []byte) []byte

Rand заполняет dst случайным набором символов латинского алфавита. Необходимое условие: len(dst) > 0

Types

type ByteBuffer

type ByteBuffer struct {
	B []byte
}

ByteBuffer provides byte buffer, which can be used for minimizing memory allocations. ByteBuffer may be used with functions appending data to the given []byte slice.

func (*ByteBuffer) Bytes

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

Bytes returns b.B, i.e. all the bytes accumulated in the buffer. The purpose of this function is bytes.Buffer compatibility.

func (*ByteBuffer) Len

func (b *ByteBuffer) Len() int

Len returns the size of the byte buffer.

func (*ByteBuffer) ReadFrom

func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error)

ReadFrom implements io.ReaderFrom. The function appends all the data read from r to b.

func (*ByteBuffer) Reset

func (b *ByteBuffer) Reset()

Reset makes ByteBuffer.B empty.

func (*ByteBuffer) Set

func (b *ByteBuffer) Set(p []byte)

Set sets ByteBuffer.B to p.

func (*ByteBuffer) SetString

func (b *ByteBuffer) SetString(s string)

SetString sets ByteBuffer.B to s.

func (*ByteBuffer) String

func (b *ByteBuffer) String() string

String returns string representation of ByteBuffer.

func (*ByteBuffer) Write

func (b *ByteBuffer) Write(p []byte) (int, error)

Write implements io.Writer - it appends p to ByteBuffer.B

func (*ByteBuffer) WriteByte

func (b *ByteBuffer) WriteByte(c byte) error

WriteByte appends the byte c to the buffer. The purpose of this function is bytes.Buffer compatibility. The function always returns nil.

func (*ByteBuffer) WriteString

func (b *ByteBuffer) WriteString(s string) (int, error)

WriteString appends s to ByteBuffer.B.

func (*ByteBuffer) WriteTo

func (b *ByteBuffer) WriteTo(w io.Writer) (int64, error)

WriteTo implements io.WriterTo.

Jump to

Keyboard shortcuts

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