// Load restores from the wire format.
426080
func (b *boxedMessage) Load(from []byte) error {
	var ssver, spub, snonce, sbox string
	var err error

	allMatches := messageParser.FindAllStringSubmatch(string(from), -1) // -> [][][]byte
	if len(allMatches) != 1 {
		return fmt.Errorf("invalid message format")
	}
	matches := allMatches[0]
	if len(matches) != 5 {
		return fmt.Errorf("invalid message format")
	}

	ssver = matches[1]
	spub = matches[2]
	snonce = matches[3]
	sbox = matches[4]

	b.SchemaVersion, err = strconv.Atoi(ssver)
	if err != nil {
		return err
	}

	pub, err := base64.StdEncoding.DecodeString(spub)
	if err != nil {
		return err
	}
	pubBytes := []byte(pub)
	if len(pubBytes) != 32 {
		return fmt.Errorf("public key invalid")
	}
	var public [32]byte
	copy(public[:], pubBytes[0:32])
	b.EncrypterPublic = public

	nnc, err := base64.StdEncoding.DecodeString(snonce)
	if err != nil {
		return err
	}
	nonceBytes := []byte(nnc)
	if len(nonceBytes) != 24 {
		return fmt.Errorf("nonce invalid")
	}
	var nonce [24]byte
	copy(nonce[:], nonceBytes[0:24])
	b.Nonce = nonce

	box, err := base64.StdEncoding.DecodeString(sbox)
	if err != nil {
		return err
	}
	b.Box = []byte(box)

	return nil
}
1155816
func (cfg *Config) Load(filepath string) {
	file, err := ioutil.ReadFile(filepath)
	if err != nil {
		LOGHANDLER.Fatal(err)
	}

	err = json.Unmarshal(file, cfg)
	if err != nil {
		LOGHANDLER.Fatal(err)
	}

	err = cfg.Validate()
	if err != nil {
		LOGHANDLER.Fatal(ErrInvalidPort)
	}
}
702175
func (m *nfsMounter) Load(source []string) error {
	info, err := mount.GetMounts()
	if err != nil {
		return err
	}
	re := regexp.MustCompile(`,addr=(.*)`)
MountLoop:
	for _, v := range info {
		host := "localhost"
		if len(m.servers) != 0 {
			if !strings.HasPrefix(v.Fstype, "nfs") {
				continue
			}
			matches := re.FindStringSubmatch(v.VfsOpts)
			if len(matches) != 2 {
				continue
			}

			if exists := m.serverExists(matches[1]); !exists {
				continue
			}
			host = matches[1]
		}
		m.normalizeSource(v, host)
		mount, ok := m.mounts[v.Source]
		if !ok {
			mount = &Info{
				Device:     v.Source,
				Fs:         v.Fstype,
				Minor:      v.Minor,
				Mountpoint: make([]*PathInfo, 0),
			}
			m.mounts[v.Source] = mount
		}
		// Allow Load to be called multiple times.
		for _, p := range mount.Mountpoint {
			if p.Path == v.Mountpoint {
				continue MountLoop
			}
		}
		mount.Mountpoint = append(mount.Mountpoint,
			&PathInfo{
				Path: normalizeMountPath(v.Mountpoint),
			},
		)
	}
	return nil
}
614124
func (s Session) Load(data map[string]string) {
	for key, value := range data {
		if key == SessionObjectKeyName {
			target := map[string]string{}
			if err := json.Unmarshal([]byte(value), &target); err != nil {
				sessionLog.Error("Unable to unmarshal session ", "key", SessionObjectKeyName, "error", err)
			} else {
				s[key] = target
			}
		} else {
			s[key] = value
		}

	}
}
21472
func Load(set *FIFOSet) (IO, error) {
	return &cio{
		config:  set.Config,
		closers: []io.Closer{set},
	}, nil
}
788469
func (s *RethinkStore) load(session *sessions.Session) (bool, error) {
	var data RethinkSession
	res, err := r.Table(s.Table).Get(session.ID).Run(s.Rethink)
	if err != nil {
		return false, err
	}
	if err := res.One(&data); err != nil {
		return false, err
	}
	dec := gob.NewDecoder(bytes.NewBuffer(data.Session))
	return true, dec.Decode(&session.Values)
}
125219
func (m *SnapshotMetadata) load() error {
	// This is not safe for concurrent access.
	// Exported methods will deal with locking.
	jsonData, err := ioutil.ReadFile(m.path)
	if jsonData == nil || os.IsNotExist(err) {
		m.save()
	} else {
		if err := json.Unmarshal(jsonData, &m.snapshotMetadata); err != nil {
			return err
		}
	}
	return nil
}
669241
func (j *JSONLoader) Load(s interface{}) error {
	var r io.Reader
	if j.Reader != nil {
		r = j.Reader
	} else if j.Path != "" {
		file, err := getConfig(j.Path)
		if err != nil {
			return err
		}
		defer file.Close()
		r = file
	} else {
		return ErrSourceNotSet
	}

	return json.NewDecoder(r).Decode(s)
}
1127340
func (y *YAMLLoader) Load(s interface{}) error {
	var r io.Reader

	if y.Reader != nil {
		r = y.Reader
	} else if y.Path != "" {
		file, err := getConfig(y.Path)
		if err != nil {
			return err
		}
		defer file.Close()
		r = file
	} else {
		return ErrSourceNotSet
	}

	data, err := ioutil.ReadAll(r)
	if err != nil {
		return err
	}

	return yaml.Unmarshal(data, s)
}
808409
func (l *State) Load(r io.Reader, chunkName string, mode string) error {
	if chunkName == "" {
		chunkName = "?"
	}

	if err := protectedParser(l, r, chunkName, mode); err != nil {
		return err
	}

	if f := l.stack[l.top-1].(*luaClosure); f.upValueCount() == 1 {
		f.setUpValue(0, l.global.registry.atInt(RegistryIndexGlobals))
	}
	return nil
}
1309268
func Load(config interface{}, defaultValue interface{}, args []string) error {
	return LoadWithParsers(config, defaultValue, args, nil)
}
983130
func (formats *Formats) load(url string) error {
	ext := getExt(url)
	if loader, ok := Files.formats[ext]; ok {
		f, err := openFile(filepath.Join(formats.root, url))
		if err != nil {
			return fmt.Errorf("unable to open resource: %s", err)
		}
		defer f.Close()

		return loader.Load(url, f)
	}
	return fmt.Errorf("no `FileLoader` associated with this extension: %q in url %q", ext, url)
}
931122
func Load(configFile string, data interface{}) (quick.Config, error) {
	return quick.LoadConfig(configFile, globalEtcdClient, data)
}
599017
func (t *tmxLoader) Load(url string, data io.Reader) error {
	lvl, err := createLevelFromTmx(data, url)
	if err != nil {
		return err
	}

	t.levels[url] = TMXResource{Level: lvl, url: url}
	return nil
}
856632
func (rd *reservoirReader) load(n int) error {
	m, err := rd.stream.readBytes(rd.buffer[rd.limit : rd.limit+n])
	rd.limit += m
	return err
}
452657
func Load(path string) (c Config, err error) {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		return
	}
	return Loads([]byte(data))
}
510298
func (l *MemoryLoader) Load(name string) (Template, error) {
	v, ok := l.Templates[name]
	if !ok {
		return nil, os.ErrNotExist
	}
	return &stringTemplate{name, v}, nil
}