counting

package module
v0.0.0-...-0f3846f Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2014 License: BSD-3-Clause Imports: 1 Imported by: 1

README

counting Build Status

Package counting provides wrappers to add counting to io.Reader and io.Writer. Documentation: http://godoc.org/github.com/facebookgo/counting

Documentation

Overview

Package counting provides wrappers to add counting to io.Reader and io.Writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader wraps an existing io.Reader and keeps track of how much has been read from it.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a new reader that will keep track of how much as been read.

func (*Reader) Count

func (r *Reader) Count() int

Count returns the number of bytes read so far.

func (*Reader) Read

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

Read some bytes into b and return the number of bytes read and error if any.

type Writer

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

Writer provides out of band access to the number of bytes written.

func NewWriter

func NewWriter(writer io.Writer) *Writer

NewWriter wraps an existing writer to track byte write count.

func (*Writer) Clear

func (h *Writer) Clear()

Clear zeroes the byte write counter.

func (*Writer) Count

func (h *Writer) Count() int

Count returns the total number of bytes that were written to the underlying writer since the last call to Clear.

func (*Writer) Write

func (h *Writer) Write(p []byte) (n int, err error)

Write proxies to the underlying writer.

Jump to

Keyboard shortcuts

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