// NewFileReopener returns io.Writer that will reopen the named file
// when signals are received.
978745
func NewFileReopener(filename string, sig ...os.Signal) (io.Writer, error) {
	return NewReopenWriter(fileOpener(filename), sig...)
}
960307
func NewFileRequestCloseType(Description string) *FileRequestCloseType {
	s := new(FileRequestCloseType)
	s.Description = Description
	return s
}
967277
func NewPeer(p *p2p.Peer, rw p2p.MsgReadWriter, spec *Spec) *Peer {
	return &Peer{
		Peer: p,
		rw:   rw,
		spec: spec,
	}
}
167768
func (lc *LimitedClient) NewReader(p Path, offset, length int64) (io.ReadCloser, error) {
	if lc.MaxReadBytes <= 0 || (length > 0 && length <= lc.MaxReadBytes) {
		return lc.Client.NewReader(p, offset, length)
	}

	lr := limitedReader{
		lc:           lc,
		path:         p,
		maxReadBytes: lc.MaxReadBytes,
		nextOffset:   offset,
		nextLength:   length,
	}
	if err := lr.nextReader(); err != nil {
		return nil, err
	}
	return &lr, nil
}
735828
func NewPlainFileLogger(name, file string, l LevelInfo) (Sender, error) {
	s, err := MakePlainFileLogger(file)
	if err != nil {
		return nil, err
	}

	return setup(s, name, l)
}
632161
func NewFileReadSeeker(r io.Reader) (*FileReadSeeker, error) {
	f, err := ioutil.TempFile("", "")
	if err != nil {
		return nil, err
	}

	if _, err := io.Copy(f, r); err != nil {
		return nil, err
	}

	if _, err := f.Seek(0, 0); err != nil {
		return nil, err
	}

	return &FileReadSeeker{
		file: f,
	}, nil
}
40484
func NewReopenWriter(opener Opener, sig ...os.Signal) (io.Writer, error) {
	w, err := opener.Open()
	if err != nil {
		return nil, err
	}
	c := make(chan os.Signal, 1)
	signal.Notify(c, sig...)
	r := &reopenWriter{
		writer: w,
	}
	reopen := func() {
		r.lock.Lock()
		defer r.lock.Unlock()
		if r.writer != nil {
			err := r.writer.Close()
			// io.Closer does not guarantee that it is safe to call it twice.
			r.writer = nil
			if err != nil {
				r.lastErr = err
				return
			}
		}
		w, err := opener.Open()
		if err != nil {
			r.lastErr = err
			return
		}
		r.writer = w
		r.lastErr = nil
	}
	go func() {
		for range c {
			reopen()
		}
	}()
	return r, nil
}
652428
func NewPeer(id enode.ID, name string, caps []Cap) *Peer {
	pipe, _ := net.Pipe()
	node := enode.SignNull(new(enr.Record), id)
	conn := &conn{fd: pipe, transport: nil, node: node, caps: caps, name: name}
	peer := newPeer(conn, nil)
	close(peer.closed) // ensures Disconnect doesn't block
	return peer
}
18007
func NewPluginEndorser(ps *PluginSupport) *PluginEndorser {
	return &PluginEndorser{
		SigningIdentityFetcher:  ps.SigningIdentityFetcher,
		PluginMapper:            ps.PluginMapper,
		pluginChannelMapping:    make(map[PluginName]*pluginsByChannel),
		ChannelStateRetriever:   ps.ChannelStateRetriever,
		TransientStoreRetriever: ps.TransientStoreRetriever,
	}
}
694646
func NewFileRenameType(Description string) *FileRenameType {
	s := new(FileRenameType)
	s.Description = Description
	return s
}
875520
func NewWriter(writer io.Writer, header *FileHeader) (*Writer, error) {
	w := &Writer{
		writer: writer,
		buf:    make([]byte, 24),
	}
	binary.LittleEndian.PutUint32(w.buf, header.MagicNumber)
	binary.LittleEndian.PutUint16(w.buf[4:], header.VersionMajor)
	binary.LittleEndian.PutUint16(w.buf[6:], header.VersionMinor)
	binary.LittleEndian.PutUint32(w.buf[8:], uint32(header.TimeZone))
	binary.LittleEndian.PutUint32(w.buf[12:], header.SigFigs)
	binary.LittleEndian.PutUint32(w.buf[16:], header.SnapLen)
	binary.LittleEndian.PutUint32(w.buf[20:], header.Network)
	if _, err := writer.Write(w.buf); err != nil {
		return nil, err
	}
	return w, nil
}
374209
func NewFileWriter(file *os.File, strategy WriteStrategy) Writer {
    return &writer{strategy(file)}
}
930639
func NewNSEnter(mounter mount.Interface, ne *nsenter.Nsenter, rootDir string) Interface {
	return nil
}
707507
func (s *File) NewReader(id string) (io.ReadCloser, error) {
	return os.OpenFile(s.join(s.Prefixed.Name(id)), os.O_RDONLY, 0400)
}
465503
func NewFileCloser(path string) (*FileCloser, error) {
	ff, err := os.Open(path)

	if err != nil {
		return nil, err
	}

	return &FileCloser{ff, path}, nil
}
1071025
func NewDispenser(filename string, input io.Reader) Dispenser {
	tokens, _ := allTokens(input) // ignoring error because nothing to do with it
	return Dispenser{
		filename: filename,
		tokens:   tokens,
		cursor:   -1,
	}
}
54484
func NewErrWriter(w io.Writer) io.Writer {
	return errWriter{ansiterm.NewWriter(w)}
}