// ReadFile reads the contents of the file of hfs specified by name.
// Just as ioutil.ReadFile does.
351239
func ReadFile(hfs http.FileSystem, name string) ([]byte, error) {
	fh, err := hfs.Open(name)
	if err != nil {
		return nil, err
	}
	var buf bytes.Buffer
	_, err = io.Copy(&buf, fh)
	fh.Close()
	return buf.Bytes(), err
}
1278969
func readFile(file string) ([]byte, error) {
	theFile, err := os.Open(file)
	if err != nil {
		return nil, err
	}
	defer theFile.Close()

	byteValue, err := ioutil.ReadAll(theFile)
	if err != nil {
		return nil, err
	}

	return byteValue, nil
}
130611
func (c *ConfigParser) ReadFile(path string) (Obj, error) {
	if path == "" && c.Open == nil {
		return nil, errors.New("ReadFile of empty string but Open hook not defined")
	}
	c.touchedFiles = make(map[string]bool)
	var err error
	c.rootJSON, err = c.recursiveReadJSON(path)
	return c.rootJSON, err
}
479827
func ReadConfigFile(filePath string) error {
	data, err := ioutil.ReadFile(filePath)
	if err != nil {
		return err
	}
	return ReadConfigBytes(data)
}
476720
func (f *SpecialReadFile) ReadFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (int, error) {
	f.fs.logEnter(ctx, "SpecialReadFile ReadFile")
	data, _, err := f.read(ctx)
	if err != nil {
		return 0, err
	}

	if offset >= int64(len(data)) {
		return 0, nil
	}

	data = data[int(offset):]

	return copy(bs, data), nil
}
296454
func (fbh *FileBackupHandle) ReadFile(ctx context.Context, filename string) (io.ReadCloser, error) {
	if !fbh.readOnly {
		return nil, fmt.Errorf("ReadFile cannot be called on read-write backup")
	}
	p := path.Join(*FileBackupStorageRoot, fbh.dir, fbh.name, filename)
	return os.Open(p)
}
588327
func ReadFile(fn string) (string, error) {
	fil, err := os.Open(fn)
	if err != nil {
		return "", errors.New(fmt.Sprintf("fileio.go: web.ReadFile: cannot read file <%v>", fn))
	}
	defer fil.Close()
	var l string
	r := bufio.NewReader(fil)
	for {
		lin, prefix, errl := r.ReadLine()
		if prefix {
			return "", errors.New(fmt.Sprintf("fileio.go: web.ReadFile: cannot read long lines yet. file = <%v>", fn))
		}
		if errl == io.EOF {
			break
		}
		if errl != nil {
			return "", errors.New(fmt.Sprintf("fileio.go: web.ReadFile: cannot read line for some reason. file = <%v>", fn))
		}
		l += string(lin)
	}
	return l, nil
}
1369524
func readFile(filePath, CertFile, KeyFile, CAFile string) ([]byte, error) {
	u, _ := url.Parse(filePath)
	p := getter.All(settings)

	// FIXME: maybe someone handle other protocols like ftp.
	getterConstructor, err := p.ByScheme(u.Scheme)

	if err != nil {
		return ioutil.ReadFile(filePath)
	}

	getter, err := getterConstructor(filePath, CertFile, KeyFile, CAFile)
	if err != nil {
		return []byte{}, err
	}
	data, err := getter.Get(filePath)
	return data.Bytes(), err
}
354043
func (f *FilesystemIO) ReadFile(filename string) ([]byte, error) {
	return ioutil.ReadFile(filename)
}
659812
func (p *MemFSPath) ReadFile() ([]byte, error) {
	if p.contents == nil {
		return nil, os.ErrNotExist
	}
	// TODO: Copy?
	return p.contents, nil
}
529889
func ReadFile(path string, offset uint64) *master.Call {
	return &master.Call{
		Type: master.Call_READ_FILE,
		ReadFile: &master.Call_ReadFile{
			Path:   path,
			Offset: offset,
		},
	}
}
1016084
func WriteFile(input interface{}, filename string) error {
	var (
		bytes []byte
		err   error
	)
	if bytes, err = Write(input); err != nil {
		return err
	}
	return ioutil.WriteFile(filename, bytes, 0666)
}
1043309
func ReadImageFile(name string) (rows, cols int, imgs []RawImage, err error) {
	f, err := os.Open(name)
	if err != nil {
		return 0, 0, nil, err
	}
	defer f.Close()
	z, err := gzip.NewReader(f)
	if err != nil {
		return 0, 0, nil, err
	}
	return readImageFile(z)
}
1124660
func ReadFile(t *testing.T, filepath string) []byte {
	t.Helper()
	b, err := ioutil.ReadFile(filepath)
	if err != nil {
		t.Fatalf("failed reading file: %s", err)
	}
	return b
}
22101
func (f *StandaloneFile) ReadFile() ([]byte, error) {
	return f.filespace.ReadFile(f.path)
}
930466
func readFile(ctxt *build.Context, filename string, buf *bytes.Buffer) ([]byte, error) {
	rc, err := buildutil.OpenFile(ctxt, filename)
	if err != nil {
		return nil, err
	}
	defer rc.Close()
	if buf == nil {
		buf = new(bytes.Buffer)
	}
	if _, err := io.Copy(buf, rc); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
653235
func (bh *GCSBackupHandle) ReadFile(ctx context.Context, filename string) (io.ReadCloser, error) {
	if !bh.readOnly {
		return nil, fmt.Errorf("ReadFile cannot be called on read-write backup")
	}
	object := objName(bh.dir, bh.name, filename)
	return bh.client.Bucket(*bucket).Object(object).NewReader(ctx)
}