Refine buffered reader

This commit is contained in:
世界 2022-06-12 11:30:07 +08:00
parent 857116b2cc
commit 82cc7d29b8
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 34 additions and 1 deletions

View file

@ -29,6 +29,10 @@ func (r *BufferedReader) Read(p []byte) (n int, err error) {
return r.buffer.Read(p)
}
func (r *BufferedReader) WriteTo(w io.Writer) (n int64, err error) {
return CopyExtendedBuffer(NewExtendedWriter(w), NewExtendedReader(r.upstream), r.buffer)
}
func (w *BufferedReader) Upstream() any {
return w.upstream
}