Documentation
¶
Index ¶
- Variables
- func Buffer(b *bufio.Reader) []byte
- func IsReaderBuffer(b *bufio.Reader) bool
- func NewReaderBuffer(buf []byte) *bufio.Reader
- func ReadAll(b *bufio.Reader) (ret []byte, err error)
- func ReadAtLeast(r *bufio.Reader, buf []byte, min int) (n int, err error)
- func ReadFull(r *bufio.Reader, buf []byte) (n int, err error)
- func Seek(b *bufio.Reader, offset int64, whence int) (int64, error)
- func UnderlyingReader(b interface{}) io.Reader
- type Reader
Constants ¶
This section is empty.
Variables ¶
var ErrSeekUnsupported = errors.New("bufio: the underlying reader doesn't support seek")
ErrSeekUnsupported error.
Functions ¶
func IsReaderBuffer ¶
IsReaderBuffer returns if this Reader instance is returned by NewReaderBuffer
func NewReaderBuffer ¶
NewReaderBuffer returns a new Reader who uses a extern buffer.
func ReadAtLeast ¶
ReadAtLeast reads from r into buf until it has read at least min bytes. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading fewer than min bytes, ReadAtLeast returns ErrUnexpectedEOF. If min is greater than the length of buf, ReadAtLeast returns ErrShortBuffer. On return, n >= min if and only if err == nil. If r returns an error having read at least min bytes, the error is dropped.
func ReadFull ¶
ReadFull reads exactly len(buf) bytes from r into buf. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading some but not all the bytes, ReadFull returns ErrUnexpectedEOF. On return, n == len(buf) if and only if err == nil. If r returns an error having read at least len(buf) bytes, the error is dropped.
func Seek ¶
Seek sets the offset for the next Read or Write to offset, interpreted according to whence: SeekStart means relative to the start of the file, SeekCurrent means relative to the current offset, and SeekEnd means relative to the end. Seek returns the new offset relative to the start of the file and an error, if any.
func UnderlyingReader ¶
UnderlyingReader returns the underlying reader.
Types ¶
type Reader ¶
Reader class.
func NewReader ¶
func NewReader(rd io.ReadSeeker) *Reader
NewReader returns a new Reader whose buffer has the default size.
func NewReaderSize ¶
func NewReaderSize(rd io.ReadSeeker, size int) *Reader
NewReaderSize returns a new Reader whose buffer has at least the specified size. If the argument io.Reader is already a Reader with large enough size, it returns the underlying Reader.
func (*Reader) ReadAtLeast ¶
ReadAtLeast reads from r into buf until it has read at least min bytes. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading fewer than min bytes, ReadAtLeast returns ErrUnexpectedEOF. If min is greater than the length of buf, ReadAtLeast returns ErrShortBuffer. On return, n >= min if and only if err == nil. If r returns an error having read at least min bytes, the error is dropped.
func (*Reader) ReadFull ¶
ReadFull reads exactly len(buf) bytes from r into buf. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading some but not all the bytes, ReadFull returns ErrUnexpectedEOF. On return, n == len(buf) if and only if err == nil. If r returns an error having read at least len(buf) bytes, the error is dropped.
func (*Reader) Seek ¶
Seek sets the offset for the next Read or Write to offset, interpreted according to whence: SeekStart means relative to the start of the file, SeekCurrent means relative to the current offset, and SeekEnd means relative to the end. Seek returns the new offset relative to the start of the file and an error, if any.