bytecounter

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package bytecounter contains a reader/writer that allows to count bytes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadWriter

type ReadWriter struct {
	*Reader
	*Writer
}

ReadWriter allows to count read and written bytes.

func NewReadWriter

func NewReadWriter(rw io.ReadWriter) *ReadWriter

NewReadWriter allocates a ReadWriter.

type Reader

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

Reader allows to count read bytes.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader allocates a Reader.

func (*Reader) Count

func (r *Reader) Count() uint64

Count returns received bytes.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read implements io.Reader.

func (*Reader) SetCount

func (r *Reader) SetCount(v uint64)

SetCount sets read bytes.

type Writer

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

Writer allows to count written bytes.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter allocates a Writer.

func (*Writer) Count

func (w *Writer) Count() uint64

Count returns sent bytes.

func (*Writer) SetCount

func (w *Writer) SetCount(v uint64)

SetCount sets sent bytes.

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

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