0Pricing
Go Academy · Lesson

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

  1. The Reader Interface
  2. The Writer Interface
  3. io Utility Functions
  4. Implementing Custom Readers
← Back to Go Academy