【文件属性】:
文件名称:nio:Go #golang中的并发缓冲IO
文件大小:6KB
文件格式:ZIP
更新时间:2021-05-13 19:01:19
Go
o
用法
缓冲区接口:
type Buffer interface {
Len () int64
Cap () int64
io. ReadWriter
}
nio的Copy方法同时从io.Reader复制到提供的nio.Buffer,然后从nio.Buffer复制到io.Writer。 这样,阻止写入不会降低io.Reader的速度。
import (
"github.com/djherbis/buffer"
"github.com/djherbis/nio/v3"
)
buf := buffer . New ( 32 * 1024 ) // 32KB In memory Buffer
nio . Copy ( w , r , buf ) // Reads and Writes concurrently, buffering using buf.
nio的Pipe方
【文件预览】:
nio-master
----go.mod(86B)
----nio.go(2KB)
----.travis.yml(719B)
----nio_test.go(4KB)
----go.sum(171B)
----LICENSE.txt(1KB)
----README.md(2KB)
----sync.go(4KB)