...

Package io

import "vminko.org/dscuss/io"
Overview
Index

Overview ▾

type LimitedReader

A LimitedReader reads from R but limits the amount of data returned to just N bytes. Each call to Read updates N to reflect the new amount remaining. Read returns EOF when N <= 0 or when the underlying R returns EOF.

type LimitedReader struct {
    R Reader // underlying reader
    N int64  // max bytes remaining
}

func (*LimitedReader) Read

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