utils

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesEquals added in v1.2.7

func BytesEquals(a []byte, b []byte) bool

BytesEquals check whether the given bytes is equal

func Equals added in v1.2.7

func Equals(a interface{}, b interface{}) bool

Equals check whether the given value is equal

func RandString

func RandString(n int) string

RandString create a random string no longer than n

func ToCmdLine added in v1.2.7

func ToCmdLine(cmd ...string) [][]byte

ToCmdLine convert strings to [][]byte

func ToCmdLine2 added in v1.2.7

func ToCmdLine2(commandName string, args ...string) [][]byte

Types

type LimitedReader

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

LimitedReader implements io.Reader, but you can only read the given number of bytes

func NewLimitedReader

func NewLimitedReader(src io.Reader, limit int) *LimitedReader

NewLimitedReader wraps an io.Reader to LimitedReader

func (*LimitedReader) Read

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

Read reads up to len(p) bytes into p. if meets EOF from src or reach limit, it returns EOF

Jump to

Keyboard shortcuts

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