I think you're misunderstanding the documentation of the Buffered
method. It returns the number of bytes it's read into its buffer,
*not* the number of bytes that are in the underlying io.Reader. Since
you haven't read anything yet in your code, the bufio.Reader hasn't
read anything into its buffer.
- Evan
I find that to be a pretty clear description. Consider that it could
be impossible or at least expensive to find the number of bytes in the
underlying io.Reader when all you have to go off of is the Read
method. How would you propose to do it with this type, for example:
type nullReader struct{}
func (r *nullReader) Read(p []byte) (int, os.Error) {
for i := range p {
p[i] = 0
}
return len(p), nil
}
- Evan
// Decode integer
}reader.Discard(4)
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/1smBsPOdFT0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20191216122707.4nx3gueuibk4dpua%40basil.wdw.