Code for reading the stream header.