Summary
This chapter provides a high-level view of Go's data input and output idioms and the packages involved in implementing IO primitives. The chapter starts by covering the fundamentals of a stream-based IO in Go with the io.Reader
and io.Writer
interfaces. Readers are walked through the implementation strategies and examples for both an io.Reader
and an io.Writer
.
The chapter goes on to cover packages, types, and functions that that support the streaming IO mechanism including working with files, formatted IO, buffered, and in-memory IO. The last portion of the chapter covers encoders and decoders that convert data as it is being streamed. In the next chapter, the IO theme is carried further when the discussion turns to creating programs that use IO to communicate via networking.