1,往Writer接口写字符串
往一个实现了io.Writer接口的类型writer写字符串
io.WriterString(writer,"hahahhah")
2,从Reader接口里读字符串
r:=bufdio.NewReader(Reader)
r.ReadLine()
body := response.Body
container,err:=ioutil.ReadAll(body)
3,将Reader接口类型读出来写入到Writer接口
io.Copy(dest Writer,src Reader) //相当于倒水,src的水会倒入到dest里 src里的水会为空
网友评论