// ReadDSFTags reads DSF metadata from the io.ReadSeeker, returning the resulting
// metadata in a Metadata implementation, or non-nil error if there was a problem.
// samples: http://www.2l.no/hires/index.html
544164
func ReadDSFTags(r io.ReadSeeker) (Metadata, error) {
	dsd, err := readString(r, 4)
	if err != nil {
		return nil, err
	}
	if dsd != "DSD " {
		return nil, errors.New("expected 'DSD '")
	}

	_, err = r.Seek(int64(16), io.SeekCurrent)
	if err != nil {
		return nil, err
	}

	n4, err := readBytes(r, 8)
	if err != nil {
		return nil, err
	}
	id3Pointer := getIntLittleEndian(n4)

	_, err = r.Seek(int64(id3Pointer), io.SeekStart)
	if err != nil {
		return nil, err
	}

	id3, err := ReadID3v2Tags(r)
	if err != nil {
		return nil, err
	}

	return metadataDSF{id3}, nil
}
486503
func ReadConfigs(path string) ([]*Config, error) {
	var r io.Reader
	name := path
	if path == "-" {
		r = os.Stdin
		name = "standard input"
	} else {
		f, err := os.Open(flagConf)
		if err != nil {
			return nil, err
		}
		defer f.Close()
		r = f
	}
	return readConfigsFromReader(r, name)
}
422383
func (r *ReadGroup) Tags(fn func(t Tag, value string)) {
	if fn == nil {
		return
	}
	fn(idTag, r.name)
	if r.center != "" {
		fn(centerTag, r.center)
	}
	if r.description != "" {
		fn(descriptionTag, r.description)
	}
	if !r.date.IsZero() {
		fn(dateTag, r.date.Format(iso8601TimeDateN))
	}
	if r.flowOrder != "" {
		fn(flowOrderTag, r.flowOrder)
	}
	if r.keySeq != "" {
		fn(keySequenceTag, r.keySeq)
	}
	if r.library != "" {
		fn(libraryTag, r.library)
	}
	if r.program != "" {
		fn(programTag, r.program)
	}
	if r.insertSize != 0 {
		fn(insertSizeTag, fmt.Sprint(r.insertSize))
	}
	if r.platform != "" {
		fn(platformTag, r.platform)
	}
	if r.platformUnit != "" {
		fn(platformUnitTag, r.platformUnit)
	}
	if r.sample != "" {
		fn(sampleTag, r.sample)
	}
	for _, tp := range r.otherTags {
		fn(tp.tag, tp.value)
	}
}
1281290
func MustParseClientGenTags(lines []string) Tags {
	tags, err := ParseClientGenTags(lines)
	if err != nil {
		panic(err.Error())
	}
	return tags
}
294510
func (c *RFCListCommand) VisitAllFlags(fn func(*flag.Flag)) {
	c.flags.VisitAll(fn)
}
1259671
func (c *DumpCommand) VisitAllFlags(fn func(*flag.Flag)) {
	c.flags.VisitAll(fn)
}
133457
func ReadTimetag(data []byte) (Timetag, error) {
	if len(data) < TimetagSize {
		return Timetag(0), errors.New("timetags must be 64-bit")
	}
	zero := []byte{0, 0, 0, 0}
	var (
		L     = append(zero, data[:TimetagSize/2]...)
		R     = append(zero, data[TimetagSize/2:]...)
		secs  uint64
		nsecs uint64
	)
	_ = binary.Read(bytes.NewReader(L), byteOrder, &secs)  // Never fails
	_ = binary.Read(bytes.NewReader(R), byteOrder, &nsecs) // Never fails
	return Timetag((secs << 32) + nsecs), nil
}
1004129
func (v *RsyncVolume) ReadMetadata(label, name string) (io.ReadCloser, error) {
	// check the metadata directory first
	label = v.rawSnapshotLabel(label)
	filename := filepath.Join(v.driver.MetadataDir(), label, name)

	return os.Open(filename)
}
364848
func ReadTokenSetFromJson(ctx context.Context, jsonString string) (*TokenSet, error) {
	var token TokenSet
	err := json.Unmarshal([]byte(jsonString), &token)
	if err != nil {
		return nil, errors.Wrapf(err, "error when unmarshal json with access token %s ", jsonString)
	}
	return &token, nil
}
171041
func parseSeriesKey(data []byte, dst models.Tags) ([]byte, models.Tags) {
	var name []byte
	_, data = ReadSeriesKeyLen(data)
	name, data = ReadSeriesKeyMeasurement(data)
	tagN, data := ReadSeriesKeyTagN(data)

	dst = dst[:cap(dst)] // Grow dst to use full capacity
	if got, want := len(dst), tagN; got < want {
		dst = append(dst, make(models.Tags, want-got)...)
	} else if got > want {
		dst = dst[:want]
	}
	dst = dst[:tagN]

	for i := 0; i < tagN; i++ {
		var key, value []byte
		key, value, data = ReadSeriesKeyTag(data)
		dst[i].Key, dst[i].Value = key, value
	}

	return name, dst
}
67844
func ReadArguments(typetags, data []byte) ([]Argument, error) {
	args := []Argument{}

	// Strip off the prefix.
	if len(typetags) > 0 && typetags[0] == TypetagPrefix {
		typetags = typetags[1:]
	}

	for i, tt := range typetags {
		arg, idx, err := ReadArgument(tt, data)
		if err != nil {
			return nil, errors.Wrapf(err, "read argument %d", i)
		}
		args = append(args, arg)
		data = data[idx:]
	}
	return args, nil
}
613735
func (c *EvalCommand) VisitAllFlags(fn func(*flag.Flag)) {
	c.flags.VisitAll(fn)
}
603047
func getTagsDX(conn *directconnect.DirectConnect, d *schema.ResourceData, arn string) error {
	resp, err := conn.DescribeTags(&directconnect.DescribeTagsInput{
		ResourceArns: aws.StringSlice([]string{arn}),
	})
	if err != nil {
		return err
	}

	var tags []*directconnect.Tag
	if len(resp.ResourceTags) == 1 && aws.StringValue(resp.ResourceTags[0].ResourceArn) == arn {
		tags = resp.ResourceTags[0].Tags
	}

	if err := d.Set("tags", tagsToMapDX(tags)); err != nil {
		return err
	}

	return nil
}
950683
func (v *BtrfsVolume) ReadMetadata(label, name string) (io.ReadCloser, error) {
	filePath := filepath.Join(v.snapshotPath(label), name)
	return os.Open(filePath)
}
636813
func (o *AggregatorOptions) AddFlags(fs *pflag.FlagSet) {
	o.RecommendedOptions.AddFlags(fs)
	o.APIEnablement.AddFlags(fs)
	fs.StringVar(&o.ProxyClientCertFile, "proxy-client-cert-file", o.ProxyClientCertFile, "client certificate used identify the proxy to the API server")
	fs.StringVar(&o.ProxyClientKeyFile, "proxy-client-key-file", o.ProxyClientKeyFile, "client certificate key used identify the proxy to the API server")
}
248995
func (mc MongoClient) ReadingsByValueDescriptorNames(names []string, limit int) ([]contract.Reading, error) {
	return mapReadings(mc.getReadingsLimit(bson.M{"name": bson.M{"$in": names}}, limit))
}
112849
func ReadFrom(r io.ReadSeeker) (Metadata, error) {
	b, err := readBytes(r, 11)
	if err != nil {
		return nil, err
	}

	_, err = r.Seek(-11, io.SeekCurrent)
	if err != nil {
		return nil, fmt.Errorf("could not seek back to original position: %v", err)
	}

	switch {
	case string(b[0:4]) == "fLaC":
		return ReadFLACTags(r)

	case string(b[0:4]) == "OggS":
		return ReadOGGTags(r)

	case string(b[4:8]) == "ftyp":
		return ReadAtoms(r)

	case string(b[0:3]) == "ID3":
		return ReadID3v2Tags(r)

	case string(b[0:4]) == "DSD ":
		return ReadDSFTags(r)
	}

	m, err := ReadID3v1Tags(r)
	if err != nil {
		if err == ErrNotID3v1 {
			err = ErrNoTagsFound
		}
		return nil, err
	}
	return m, nil
}