Exemple #1
0
func (s *StrucStream) Unpack(vals ...interface{}) error {
	for _, val := range vals {
		err := struc.UnpackWithOptions(s.Stream, val, s.Options)
		if err != nil {
			return err
		}
	}
	return nil
}
Exemple #2
0
func (s *SaveHeader) UnpackBody() (*SaveBody, error) {
	gz, err := zlib.NewReader(bytes.NewReader(s.Compressed))
	if err != nil {
		return nil, err
	}
	body := &SaveBody{}
	err = struc.UnpackWithOptions(gz, body, &struc.Options{Order: binary.BigEndian})
	if err != nil {
		return nil, err
	}
	return body, nil
}