gbytes

package
v0.0.0-...-3e416e1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	B  ByteSize = 1
	KB          = B << 10
	MB          = KB << 10
	GB          = MB << 10
	TB          = GB << 10
	PB          = TB << 10
	EB          = PB << 10
)

Variables

View Source
var ErrBits = errors.New("unit with capital unit prefix and lower case unit (b) - bits, not bytes ")

Functions

func ParseSize

func ParseSize(s string) (bytes uint64, err error)

func SizeStr

func SizeStr(bytes uint64) (s string, err error)

Types

type ByteSize

type ByteSize uint64

func (ByteSize) Bytes

func (b ByteSize) Bytes() uint64

func (ByteSize) EBytes

func (b ByteSize) EBytes() float64

func (ByteSize) GBytes

func (b ByteSize) GBytes() float64

func (ByteSize) HR

func (b ByteSize) HR() string

func (ByteSize) HumanReadable

func (b ByteSize) HumanReadable() (s string)

func (ByteSize) KBytes

func (b ByteSize) KBytes() float64

func (ByteSize) MBytes

func (b ByteSize) MBytes() float64

func (*ByteSize) MustParse

func (b *ByteSize) MustParse(str string) *ByteSize

func (ByteSize) PBytes

func (b ByteSize) PBytes() float64

func (*ByteSize) Parse

func (b *ByteSize) Parse(str string) (err error)

func (ByteSize) String

func (b ByteSize) String() (s string)

func (ByteSize) TBytes

func (b ByteSize) TBytes() float64

type BytesBuilder

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

func NewBytesBuilder

func NewBytesBuilder() *BytesBuilder

func (*BytesBuilder) Bytes

func (s *BytesBuilder) Bytes() []byte

func (*BytesBuilder) String

func (s *BytesBuilder) String() string

func (*BytesBuilder) Write

func (s *BytesBuilder) Write(data []byte) (err error)

func (*BytesBuilder) WriteLn

func (s *BytesBuilder) WriteLn(data []byte) (err error)

func (*BytesBuilder) WriteStr

func (s *BytesBuilder) WriteStr(format string, values ...interface{}) (err error)

func (*BytesBuilder) WriteStrLn

func (s *BytesBuilder) WriteStrLn(format string, values ...interface{}) (err error)

type CircularBuffer

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

func NewCircularBuffer

func NewCircularBuffer(size int) *CircularBuffer

func (*CircularBuffer) Bytes

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

func (*CircularBuffer) Close

func (b *CircularBuffer) Close() error

func (*CircularBuffer) NewHistoryReader

func (b *CircularBuffer) NewHistoryReader() io.ReadCloser

func (*CircularBuffer) NewReader

func (b *CircularBuffer) NewReader() io.ReadCloser

func (*CircularBuffer) Reset

func (b *CircularBuffer) Reset()

func (*CircularBuffer) ResetReader

func (b *CircularBuffer) ResetReader(r io.ReadCloser)

func (*CircularBuffer) SetReaderDeadline

func (b *CircularBuffer) SetReaderDeadline(r io.ReadCloser, deadline time.Time)

func (*CircularBuffer) TouchTime

func (b *CircularBuffer) TouchTime() time.Time

func (*CircularBuffer) Write

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

func (*CircularBuffer) Writer

func (b *CircularBuffer) Writer() *IOWriter

type CircularReader

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

func (*CircularReader) Close

func (r *CircularReader) Close() error

func (*CircularReader) Read

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

type IOWriter

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

func NewIOWriter

func NewIOWriter(w io.Writer) *IOWriter

func (*IOWriter) Write

func (s *IOWriter) Write(data []byte) (err error)

func (*IOWriter) WriteLn

func (s *IOWriter) WriteLn(data []byte) (err error)

func (*IOWriter) WriteStr

func (s *IOWriter) WriteStr(format string, values ...interface{}) (err error)

func (*IOWriter) WriteStrLn

func (s *IOWriter) WriteStrLn(format string, values ...interface{}) (err error)

type Pool

type Pool struct {
	*sync.Pool
}

func GetPool

func GetPool(bufSize int) *Pool

func NewPool

func NewPool(bufSize int) *Pool

func (*Pool) Get

func (s *Pool) Get() interface{}

func (*Pool) Put

func (s *Pool) Put(x interface{})

Jump to

Keyboard shortcuts

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