mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-03 15:55:20 -05:00
refactor buffer
This commit is contained in:
15
common/buf/io.go
Normal file
15
common/buf/io.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package buf
|
||||
|
||||
import "io"
|
||||
|
||||
func ReadFrom(reader io.Reader) Supplier {
|
||||
return func(b []byte) (int, error) {
|
||||
return reader.Read(b)
|
||||
}
|
||||
}
|
||||
|
||||
func ReadFullFrom(reader io.Reader, size int) Supplier {
|
||||
return func(b []byte) (int, error) {
|
||||
return io.ReadFull(reader, b[:size])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user