1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-27 12:35:21 -05:00

remove closure on ReadFullFrom

This commit is contained in:
Darien Raymond
2018-11-02 15:01:33 +01:00
parent 9360448c59
commit 58e2ed3381
27 changed files with 158 additions and 90 deletions

View File

@@ -26,20 +26,6 @@ type Writer interface {
WriteMultiBuffer(MultiBuffer) error
}
// ReadFrom creates a Supplier to read from a given io.Reader.
func ReadFrom(reader io.Reader) Supplier {
return func(b []byte) (int, error) {
return reader.Read(b)
}
}
// ReadFullFrom creates a Supplier to read full buffer from a given io.Reader.
func ReadFullFrom(reader io.Reader, size int32) Supplier {
return func(b []byte) (int, error) {
return io.ReadFull(reader, b[:size])
}
}
// WriteAllBytes ensures all bytes are written into the given writer.
func WriteAllBytes(writer io.Writer, payload []byte) error {
for len(payload) > 0 {