On Mon, 31 Aug 2015 10:39:59 -0700 (PDT)
WALID BELRHALMIA <
wbelr...@gmail.com> wrote:
> i didn't understand this documentation {{{{
>
> type Reader struct {
>
> // contains filtered or unexported fields}
>
> func NewReader(rd io <
http://golang.org/pkg/io/>.Reader
> <
http://golang.org/pkg/io/#Reader>) *Reader
> <
http://golang.org/pkg/bufio/#Reader>
>
> NewReader returns a new Reader whose buffer has the default size
>
> }}}}
>
> *what is the buffer of a Reader struct how it's implemented*
To elaborate on Brad's response, you don't necessarily need to have
direct to the fields of variables of a particular type for such
variables to be useful, and bufio.Reader is an example of a type with
no directly accessible fields.
The basic idea is that a variable of type bufio.Reader does only hold
some internal state enabling certain methods, namely Read(), be called
on this variable repeatedly -- making it read its source data
sequentially. You have no business fiddling with this state, and hence
it's not made available to you.