// Open returns an io.Reader for the file.
556560
func (f *File) Open() (io.Reader, error) {
	if f.ino.Mode&ifmt != ifreg {
		return nil, fmt.Errorf("not a regular file")
	}
	return &fileReader{f, 0}, nil
}
58622
func (fs *FS) Open(filename string) (billy.File, error) {
	return fs.OpenFile(filename, os.O_RDONLY, 0600)
}
1232226
func (img *Image) Open() (*File, error) {
	if img.sds == nil {
		rsrc, err := img.wim.resourceReaderWithOffset(&img.offset, img.rootOffset)
		if err != nil {
			return nil, err
		}
		sds, n, err := img.wim.readSecurityDescriptors(rsrc)
		if err != nil {
			rsrc.Close()
			return nil, err
		}
		img.sds = sds
		img.r = rsrc
		img.rootOffset = n
		img.curOffset = n
	}

	f, err := img.readdir(img.rootOffset)
	if err != nil {
		return nil, err
	}
	if len(f) != 1 {
		return nil, &ParseError{Oper: "root directory", Err: errors.New("expected exactly 1 root directory entry")}
	}
	return f[0], err
}
144103
func (t *FileTarget) Open(errWriter io.Writer) error {
	t.Filter.Init()
	if t.FileName == "" {
		return errors.New("FileTarget.FileName must be set")
	}
	if t.Rotate {
		if t.BackupCount < 0 {
			return errors.New("FileTarget.BackupCount must be no less than 0")
		}
		if t.MaxBytes <= 0 {
			return errors.New("FileTarget.MaxBytes must be no less than 0")
		}
	}

	fd, err := os.OpenFile(t.FileName, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0660)
	if err != nil {
		return fmt.Errorf("FileTarget was unable to create a log file: %v", err)
	}
	t.fd = fd
	t.errWriter = errWriter

	return nil
}
702369
func (tsz *TarSz) Open(in io.Reader, size int64) error {
	tsz.wrapReader()
	return tsz.Tar.Open(in, size)
}
1235147
func Open(filename string) (rc *ReadCloser, err error) {
	fp, err := os.Open(filename)
	if err != nil {
		return nil, err
	}

	if strings.HasSuffix(filename, ".gz") {
		r := &ReadCloser{
			fp:     fp,
			isGzip: true,
			isOpen: true,
		}
		r.gz, err = gzip.NewReader(fp)
		if err != nil {
			fp.Close()
			return nil, err
		}
		r.r = r.gz
		runtime.SetFinalizer(r, (*ReadCloser).Close)
		return r, nil
	}

	if strings.HasSuffix(filename, ".bz2") {
		r := &ReadCloser{
			fp:      fp,
			r:       bzip2.NewReader(fp),
			isBzip2: true,
			isOpen:  true,
		}
		runtime.SetFinalizer(r, (*ReadCloser).Close)
		return r, nil
	}

	r := &ReadCloser{
		fp:      fp,
		r:       fp,
		isOpen:  true,
	}
	runtime.SetFinalizer(r, (*ReadCloser).Close)
	return r, nil
}
944632
func (tgz *TarGz) Open(in io.Reader, size int64) error {
	tgz.wrapReader()
	return tgz.Tar.Open(in, size)
}
657101
func Open(name string, opts Options) (*Tag, error) {
	file, err := os.Open(name)
	if err != nil {
		return nil, err
	}
	return ParseReader(file, opts)
}
475062
func (f *LogFile) Open() error {
	if err := f.open(); err != nil {
		f.Close()
		return err
	}
	return nil
}
144550
func Open(path string) (*zip.Reader, error) {
	_, rd, err := OpenCloser(path)
	return rd, err
}
1054626
func (b *Box) Open(name string) (http.File, error) {
	plog.Debug(b, "Open", "name", name)
	f, err := b.Resolve(name)
	if err != nil {
		if len(filepath.Ext(name)) == 0 {
			return b.openWoExt(name)
		}
		return f, err
	}
	f, err = file.NewFileR(name, f)
	plog.Debug(b, "Open", "name", f.Name(), "file", f.Name())
	return f, err
}
828328
func IOOpen(l *State) int {
	NewLibrary(l, ioLibrary)

	NewMetaTable(l, fileHandle)
	l.PushValue(-1)
	l.SetField(-2, "__index")
	SetFunctions(l, fileHandleMethods, 0)
	l.Pop(1)

	registerStdFile(l, os.Stdin, input, "stdin")
	registerStdFile(l, os.Stdout, output, "stdout")
	registerStdFile(l, os.Stderr, "", "stderr")

	return 1
}
1354443
func Open(fname string, flags int, fn FileOpFunc) error {
	fd, err := os.OpenFile(fname, flags, FilePerm)
	if err != nil {
		return err
	}

	if fn != nil {
		err = fn(fd)
	}
	if e := fd.Close(); e != nil && err == nil {
		err = e
	}

	return io2.NonEOF(err)
}
1338343
func (r *Rar) Open(in io.Reader, size int64) error {
	if r.rr != nil {
		return fmt.Errorf("rar archive is already open for reading")
	}
	var err error
	r.rr, err = rardecode.NewReader(in, r.Password)
	return err
}
129951
func Open(fs Filesystem, name string) (File, error) {
	return fs.OpenFile(name, os.O_RDONLY, 0)
}
532369
func Open(filename string) (image.Image, error) {
	f, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	img, _, err := image.Decode(f)
	if err != nil {
		return nil, err
	}

	return img, nil
}
294328
func (c *Client) Open(name string) *File {
	r, w := io.Pipe()
	return &File{
		Name:  name,
		c:     c,
		pipeR: r,
		pipeW: w,
	}
}