// WriteBulk writes a bulk string
778820
func (w *Writer) WriteBulk(s string) {
	fmt.Fprintf(w.w, "$%d\r\n%s\r\n", len(s), s)
}
1329816
func (b *ByteBuf) WriteString(v string) error {
	_, err := b.Write(StringToSlice(v))
	return err
}
655691
func writeLPBytes(buf []byte, b []byte, t Type) (int, error) {
	total, n := 0, len(b)

	if n > int(maxLPLength) {
		return 0, makeError(t, "length (%d) greater than %d bytes", n, maxLPLength)
	}

	if len(buf) < 2+n {
		return 0, makeError(t, "insufficient buffer size, expected %d, got %d", 2+n, len(buf))
	}

	binary.BigEndian.PutUint16(buf, uint16(n))
	total += 2

	copy(buf[total:], b)
	total += n

	return total, nil
}
700728
func (e ext) WriteExt(v interface{}) (buf []byte) {
	buf, err := e.codec.Encode(v)
	if err != nil {
		panic(fmt.Sprintf("Couldn't encode data in %v", v))
	}
	return buf
}
585771
func (s *serialWriteCloser) Write(data []byte) (int, error) {
	s.mu.Lock()
	defer s.mu.Unlock()
	return s.wc.Write(data)
}
985787
func (p *TCompactProtocol) WriteString(value string) error {
	buf := make([]byte, len(value))
	strings.NewReader(value).Read(buf)
	return p.WriteBinary(buf)
}
99886
func splitBulk(s string) []string {
	f := func(c rune) bool {
		return c == '\n' || c == ','
	}
	split := strings.FieldsFunc(s, f)
	for i, s := range split {
		split[i] = strings.TrimSpace(s)
	}
	return split
}
381939
func (ru *resumableUpload) Write(buf []byte) (int, error) {
	sb := ru.splitBuf

	written := 0
	for written < len(buf) {
		if err := ru.checkError(); err != nil {
			return 0, err
		}
		if ru.closed {
			return 0, nil
		}

		availRead := len(buf) - written
		availWrite := sb.Cap() - sb.Len()

		if availWrite == 0 {
			// flush!
			data := sb.Bytes()
			ru.blocks <- &rblock{
				data: append([]byte{}, data...),
			}
			sb.Reset()
			availWrite = sb.Cap()
		}

		copySize := availRead
		if copySize > availWrite {
			copySize = availWrite
		}

		// buffer!
		sb.Write(buf[written : written+copySize])
		written += copySize
	}

	return written, nil
}
856498
func (b *Buffer) WriteString(s string) (n int, err error) {
	m := b.grow(len(s))
	return copy(b.buf[m:], s), nil
}
963112
func (b *ByteBuffer) Write(p []byte) (int, error) {
	b.B = append(b.B, p...)
	return len(p), nil
}
295158
func Write(w io.Writer, data ...interface{}) error {
	for _, v := range data {
		if err := binary.Write(w, binary.BigEndian, v); err != nil {
			return err
		}
	}

	return nil
}
990514
func (be *BinaryEncoder) WriteString(x string) {
	be.WriteLong(int64(len(x)))
	_, _ = be.buffer.Write([]byte(x))
}
233956
func (w *Writer) Write(p []byte) (n int, err error) {
	return w.buf.Write(p)
}
1213526
func writeLPString(buf []byte, str string, t Type) (int, error) {
	return writeLPBytes(buf, []byte(str), t)
}
15156
func (w *BatchedFileWriter) Write(p []byte) (n int, err error) {
	w.activeBuffer.Write(p)

	if size, _ := w.activeBuffer.Size(); size >= minUploadPartSize {
		w.logger.WithField("size", size).Debug("Buffer size ready for request")
		w.uploadPartInput()
	} else {
		w.logger.WithField("size", size).Debug("Buffer size not big enough vor request")
	}

	length := len(p)
	w.totalSize += length
	return length, nil
}
1194355
func (s *stdlogAdapter) Write(data []byte) (int, error) {
	str := string(bytes.TrimRight(data, " \t\n"))

	if s.forceLevel != NoLevel {
		// Use pickLevel to strip log levels included in the line since we are
		// forcing the level
		_, str := s.pickLevel(str)

		// Log at the forced level
		switch s.forceLevel {
		case Trace:
			s.log.Trace(str)
		case Debug:
			s.log.Debug(str)
		case Info:
			s.log.Info(str)
		case Warn:
			s.log.Warn(str)
		case Error:
			s.log.Error(str)
		default:
			s.log.Info(str)
		}
	} else if s.inferLevels {
		level, str := s.pickLevel(str)
		switch level {
		case Trace:
			s.log.Trace(str)
		case Debug:
			s.log.Debug(str)
		case Info:
			s.log.Info(str)
		case Warn:
			s.log.Warn(str)
		case Error:
			s.log.Error(str)
		default:
			s.log.Info(str)
		}
	} else {
		s.log.Info(str)
	}

	return len(data), nil
}
1222710
func (c *Container) Write(bs []byte) (size int, err error) {
	for _, w := range c.ws {
		if size, err = w.Write(bs); err != nil {
			return
		}
	}

	return
}