// NewPlainWriter returns a json
187136
func NewTextWriter(logger logrus.FieldLogger, contentType string) *TextWriter {
	if contentType == "" {
		contentType = "plain"
	}

	writer := &TextWriter{
		logger:      logger,
		contentType: "text/" + contentType,
	}

	writer.Reporter = DefaultErrorReporter
	return writer
}
441784
func NewOverlayWriter(r io.Reader, readOffset int64, w io.Writer, overlayOffset int64) (OverlayWriter, error) {
	rbuf := make([]byte, overlayBufSize)

	ow := &overlayWriter{
		r:          r,
		readOffset: readOffset,
		rbuf:       rbuf,
	}

	cw := counter.NewWriter(w)
	cw.SetCount(overlayOffset)
	ow.cw = cw
	ow.wctx = wire.NewWriteContext(cw)

	if overlayOffset == 0 {
		err := ow.wctx.WriteMagic(OverlayMagic)
		if err != nil {
			return nil, err
		}

		err = ow.wctx.WriteMessage(&OverlayHeader{})
		if err != nil {
			return nil, err
		}
	}

	ow.bw = bufio.NewWriterSize(&overlayProcessor{ow}, overlayBufSize)

	return ow, nil
}
1146069
func (e Encoder) NewWriter(wr io.Writer) *Writer {
	w := new(Writer)
	w.wr = wr
	w.encode = e
	return w
}
667445
func NewWriter(w io.Writer) *Writer {
	return &Writer{
		w:   w,
		ctx: context.Background(),
	}
}
39705
func NewWriter(addr string) (*Writer, error) {
	var err error
	w := new(Writer)
	w.CompressionLevel = flate.BestSpeed

	if w.conn, err = net.Dial("udp", addr); err != nil {
		return nil, err
	}
	if w.hostname, err = os.Hostname(); err != nil {
		return nil, err
	}

	w.Facility = path.Base(os.Args[0])

	return w, nil
}
789148
func NewWriteHandler(writer storage.PointsWriter) *WriteHandler {
	h := &WriteHandler{
		Router:       NewRouter(),
		Logger:       zap.NewNop(),
		PointsWriter: writer,
	}

	h.HandlerFunc("POST", writePath, h.handleWrite)
	return h
}
743821
func NewMirrorWriter() *MirrorWriter {
	mw := &MirrorWriter{
		msgSync:   make(chan []byte, 64), // sufficiently large buffer to avoid callers waiting
		writerAdd: make(chan *writerAdd),
	}

	go mw.logRoutine()

	return mw
}
1142151
func NewPlanner(ctx *Context) *PlannerDefault {
	p := &PlannerDefault{
		Ctx:      ctx,
		children: make([]Task, 0),
	}
	p.Planner = p
	return p
}
1239834
func NewWriter(w io.Writer) *Writer {
	return &Writer{
		Delimiter: '\t',
		UseCRLF:   false,
		w:         bufio.NewWriter(w),
	}
}
1099085
func newWriterRESP(conn net.Conn, size int) *respWriter {
	w := new(respWriter)
	w.buff = bufio.NewWriterSize(conn, size)
	return w
}
377200
func (f *FS) NewWriter(objectName string, metadata map[string]string) (io.WriteCloser, error) {
	return f.NewWriterWithContext(context.Background(), objectName, metadata)
}
312469
func NewWriter(w io.Writer) *Writer {
	return &Writer{
		w:         multipart.NewWriter(w),
		firstPart: false,
		rootPart:  false,
	}
}
1151733
func NewIndentWriter(indentLevel uint, indentString string,
	writer io.Writer) *indentWriter {
	return &indentWriter{
		writer:      writer,
		indentLevel: indentLevel,
		indentBytes: []byte(indentString),
		indent:      true,
	}
}
1291996
func NewWriter(f io.ReadWriteSeeker, opts ...Option) *Writer {
	w := &Writer{
		f:           f,
		bw:          bufio.NewWriterSize(f, 65536*8),
		maxDiskSize: defaultMaxDiskSize,
	}
	for _, opt := range opts {
		opt(w)
	}
	return w
}
454666
func NewWrapWriter(w io.WriterAt, off int64, wrapAt int64) *WrapWriter {
	return &WrapWriter{
		&wrapper{
			doat:   w.WriteAt,
			off:    (off % wrapAt),
			wrapAt: wrapAt,
		},
	}
}
406824
func NewWriter(w io.WriteCloser, bytesPerSec, burstLimit int) *Writer {
	limiter := NewRate(bytesPerSec, burstLimit)

	return &Writer{
		w:       w,
		ctx:     context.Background(),
		limiter: limiter,
	}
}
1174898
func NewDialectWriter(l, i byte) DialectWriter {
	return &defaultDialect{LiteralQuote: l, IdentityQuote: i}
}