bytez

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 4 Imported by: 1

README

gopherz

ezpkg.io/bytez

PkgGoDev GitHub License version

Package bytez provides utilities for working with byte slices. It aims to extend the standard library bytes package with additional functionality.

Installation

go get -u ezpkg.io/bytez@v0.1.2

Examples

bytez.Buffer

The stdlib bytes.Buffer provides many functions that always return nil error. They have their counterparts in bytez.Buffer that eliminate the need of error handling.

// stdlib: bytes.Buffer
_, err = b.WriteString()
if err != nil {
	return err
}
_, err = fmt.Fprintf(&b, "Hello, %s!", "world")
if err != nil {
	return err
}

// ezpkg.io/bytez.Buffer
b.WriteStringZ()
b.Printf("Hello, %s!", "world")

About ezpkg.io

As I work on various Go projects, I often find myself creating utility functions, extending existing packages, or developing packages to solve specific problems. Moving from one project to another, I usually have to copy or rewrite these solutions. So I created this repository to have all these utilities and packages in one place. Hopefully, you'll find them useful as well.

For more information, see the main repository.

Author

Oliver Nguyen  github

Documentation

Overview

Package bytez provides utilities for working with byte slices. It aims to extend the standard library bytes package with additional functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer bytes.Buffer

func (*Buffer) Available

func (b *Buffer) Available() int

func (*Buffer) AvailableBuffer

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

func (*Buffer) Bytes

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

func (*Buffer) Cap

func (b *Buffer) Cap() int

func (*Buffer) Grow

func (b *Buffer) Grow(n int)

func (*Buffer) Len

func (b *Buffer) Len() int

func (*Buffer) Next

func (b *Buffer) Next(n int) []byte

func (*Buffer) Print

func (b *Buffer) Print(args ...any)

func (*Buffer) PrintBytes

func (b *Buffer) PrintBytes(p []byte)

func (*Buffer) Printf

func (b *Buffer) Printf(format string, args ...any)

func (*Buffer) Println

func (b *Buffer) Println(args ...any)

func (*Buffer) Read

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

func (*Buffer) ReadByte

func (b *Buffer) ReadByte() (byte, error)

func (*Buffer) ReadBytes

func (b *Buffer) ReadBytes(delim byte) (line []byte, err error)

func (*Buffer) ReadFrom

func (b *Buffer) ReadFrom(r io.Reader) (n int64, err error)

func (*Buffer) ReadRune

func (b *Buffer) ReadRune() (r rune, size int, err error)

func (*Buffer) ReadString

func (b *Buffer) ReadString(delim byte) (line string, err error)

func (*Buffer) Reset

func (b *Buffer) Reset()

func (*Buffer) String

func (b *Buffer) String() string

func (*Buffer) Truncate

func (b *Buffer) Truncate(n int)

func (*Buffer) UnreadByte

func (b *Buffer) UnreadByte() error

func (*Buffer) UnreadRune

func (b *Buffer) UnreadRune() error

func (*Buffer) Write

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

func (*Buffer) WriteByte

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

func (*Buffer) WriteByteZ

func (b *Buffer) WriteByteZ(c byte)

func (*Buffer) WriteRune

func (b *Buffer) WriteRune(r rune) (n int, err error)

func (*Buffer) WriteRuneZ

func (b *Buffer) WriteRuneZ(r rune) int

func (*Buffer) WriteString

func (b *Buffer) WriteString(s string) (n int, err error)

func (*Buffer) WriteStringZ

func (b *Buffer) WriteStringZ(s string) int

func (*Buffer) WriteTo

func (b *Buffer) WriteTo(w io.Writer) (n int64, err error)

func (*Buffer) WriteZ

func (b *Buffer) WriteZ(p []byte) int

type Bytes added in v0.1.2

type Bytes []byte

func (Bytes) Available added in v0.1.2

func (b Bytes) Available() int

func (Bytes) Bytes added in v0.1.2

func (b Bytes) Bytes() []byte

func (Bytes) Cap added in v0.1.2

func (b Bytes) Cap() int

func (*Bytes) Grow added in v0.1.2

func (b *Bytes) Grow(n int)

func (Bytes) Len added in v0.1.2

func (b Bytes) Len() int

func (*Bytes) Print added in v0.1.2

func (b *Bytes) Print(args ...any)

func (*Bytes) PrintBytes added in v0.1.2

func (b *Bytes) PrintBytes(p []byte)

func (*Bytes) Printf added in v0.1.2

func (b *Bytes) Printf(format string, args ...any)

func (*Bytes) Println added in v0.1.2

func (b *Bytes) Println(args ...any)

func (*Bytes) Reset added in v0.1.2

func (b *Bytes) Reset()

func (Bytes) String added in v0.1.2

func (b Bytes) String() string

func (*Bytes) Write added in v0.1.2

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

func (*Bytes) WriteByte added in v0.1.2

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

func (*Bytes) WriteByteZ added in v0.1.2

func (b *Bytes) WriteByteZ(c byte)

func (*Bytes) WriteRune added in v0.1.2

func (b *Bytes) WriteRune(r rune) (n int, err error)

func (*Bytes) WriteRuneZ added in v0.1.2

func (b *Bytes) WriteRuneZ(r rune) int

func (*Bytes) WriteString added in v0.1.2

func (b *Bytes) WriteString(s string) (n int, err error)

func (*Bytes) WriteStringZ added in v0.1.2

func (b *Bytes) WriteStringZ(s string) int

func (Bytes) WriteTo added in v0.1.2

func (b Bytes) WriteTo(w io.Writer) (n int64, err error)

func (*Bytes) WriteZ added in v0.1.2

func (b *Bytes) WriteZ(p []byte) int

Jump to

Keyboard shortcuts

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