pull/320/head
Darien Raymond 8 years ago
parent ff87377acf
commit 792e8ffd20
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -20,12 +20,14 @@ type Writer interface {
Write(*Buffer) error Write(*Buffer) error
} }
// ReadFrom creates a Supplier to read from a given io.Reader.
func ReadFrom(reader io.Reader) Supplier { func ReadFrom(reader io.Reader) Supplier {
return func(b []byte) (int, error) { return func(b []byte) (int, error) {
return reader.Read(b) return reader.Read(b)
} }
} }
// ReadFullFrom creates a Supplier to read full buffer from a given io.Reader.
func ReadFullFrom(reader io.Reader, size int) Supplier { func ReadFullFrom(reader io.Reader, size int) Supplier {
return func(b []byte) (int, error) { return func(b []byte) (int, error) {
return io.ReadFull(reader, b[:size]) return io.ReadFull(reader, b[:size])

Loading…
Cancel
Save