code: func (p *Parser) readOuterMessage() (*outerMessage, error) {
  	// Read a command header, which includes both the message type
  	// well as a flag to determine whether or not whether or not the
  	// message is compressed with snappy.
  	command, err := p.stream.readCommand()
  	if err != nil {
  		return nil, err
  	}
  
  	// Extract the type and compressed flag out of the command
  	msgType := int32(command & ^dota.EDemoCommands_DEM_IsCompressed)
  	msgCompressed := (command & dota.EDemoCommands_DEM_IsCompressed) == dota.EDemoCommands_DEM_IsCompressed
  
  	// Read the tick that the message corresponds with.
  	tick, err := p.stream.readVarUint32()
  	if err != nil {
  		return nil, err
  	}
  
  	// This appears to actually be an int32, where a -1 means pre-game.
  	if tick == 4294967295 {
  		tick = 0
  	}
  
  	// Read the size and following buffer.
  	size, err := p.stream.readVarUint32()
  	if err != nil {
  		return nil, err
  	}
  
  	buf, err := p.stream.readBytes(size)
  	if err != nil {
  		return nil, err
  	}
  
  	// If the buffer is compressed, decompress it with snappy.
  	if msgCompressed {
  		var err error
  		if buf, err = snappy.Decode(nil, buf); err != nil {
  			return nil, err
  		}
  	}
  
  	// Return the message
  	msg := &outerMessage{
  		tick:   tick,
  		typeId: msgType,
  		data:   buf,
  	}
  	return msg, nil
  }
docs: // Read the next outer message from the buffer.