参考:https://blog.csdn.net/weixin_40003478/article/details/113008857

在 io 包中最重要的是两个接口:io.Reader 和 io.Writer 接口。只要实现了这两个接口,它就有了 IO 的功能。
以下类型中,常用的类型有:os.File、strings.Reader、bufio.Reader/Writer、bytes.Buffer、bytes.Reader

实现接口 其他包的类型 io包的类型
io.Writer和io.Reader os.File, bytes.Buffer, crypto/tls.Conn -
仅io.Writer bufio.Writer, compress/gzip.Writer, crypto/cipher.StreamWriter io.PipeWriter
仅io.Reader bufio.Reader, compress/gzip.Reader, crypto/cipher.StreamReader, bytes.Reader, strings.Reader, mime/multipart.Part io.LimitedReader, io.PipeReader,io.SectionReader
posted on 2022-01-11 16:57  西伯尔  阅读(65)  评论(0编辑  收藏  举报