Implementing Custom Readers
Build your own streams.
Build Your Own Streams
You can create custom data sources by implementing the one-method io.Reader interface. Your type then works with every io helper.
The Method to Implement
Implement Read(p []byte) (n int, err error) on your type. Fill p, return the count, and return io.EOF when done.
All lessons in this course
- The Reader Interface
- The Writer Interface
- io Utility Functions
- Implementing Custom Readers