Read reads len(p) bytes into p from the object data stream. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call.
If Read encounters the end of the data stream it will return err == io.EOF, either in the current call if n > 0 or in a subsequent call.
c.Assert(r.Close(), IsNil) c.Assert(r.Hash(), Equals, hash) // Test Hash() after close _, err = r.Read(make(byte, 0, 1)) c.Assert(err, Equals, ErrClosed) }