// WriteClientText is the same as WriteClientMessage with
// ws.OpText.
5833
func WriteClientText(w io.Writer, p []byte) error {
	return WriteClientMessage(w, ws.OpText, p)
}
110689
func EscapeText(w io.Writer, s []byte) error {
	return escapeText(w, s, true)
}
1338056
func ClientContextWrite(ctx Context, contexts []*ClientContext) error {
	render := func(format func(subContext SubContext) error) error {
		for _, context := range contexts {
			if err := format(&clientContextContext{c: context}); err != nil {
				return err
			}
		}
		return nil
	}
	return ctx.Write(newClientContextContext(), render)
}
968251
func statusText(code int) string {
	var buf bytes.Buffer
	bw := bufio.NewWriter(&buf)
	writeStatusText(bw, code)
	bw.Flush()
	return buf.String()
}
78178
func (txt *Text) WriteString(s string) (n int, err error) {
	txt.buf = append(txt.buf, s...)
	txt.drawBuf()
	return len(s), nil
}
748318
func (c *Conn) SendPlainText(to []string, from, subj, plaintext string) error {
	return c.conn.SendPlainText(to, from, subj, plaintext)
}
531570
func (client *socketClient) Write(msg interface{}) error {
	client.writeMtx.Lock()
	defer client.writeMtx.Unlock()
	bytes, err := json.Marshal(msg)
	if err != nil {
		return err
	}
	return client.conn.WriteMessage(websocket.TextMessage, bytes)
}
922258
func (es extSlice) WriteExt(v interface{}) (buf []byte) {
	val := reflect.ValueOf(v)
	if val.Kind() != reflect.Slice {
		panic(fmt.Sprintf("Non-slice passed to extSlice.WriteExt %v",
			val.Kind()))
	}

	ifaceArray := make([]interface{}, val.Len())
	for i := 0; i < val.Len(); i++ {
		ifaceArray[i] = val.Index(i).Interface()
	}

	buf, err := es.codec.Encode(ifaceArray)
	if err != nil {
		panic(fmt.Sprintf("Couldn't encode data in %v", v))
	}
	return buf
}
1216485
func (ctx *context) WriteString(body string) (n int, err error) {
	return ctx.writer.WriteString(body)
}
313526
func writePlainText(statusCode int, text string, w http.ResponseWriter) {
	w.Header().Set("Content-Type", "text/plain")
	w.WriteHeader(statusCode)
	fmt.Fprintln(w, text)
}
54214
func (client *Client) Text() (out string, err error) {
	if err = client.init(); err != nil {
		return
	}
	out = C.GoString(C.UTF8Text(client.api))
	if client.Trim {
		out = strings.Trim(out, "\n")
	}
	return out, err
}
72251
func CompactTextString(pb Message) string {
	var buf bytes.Buffer
	marshalText(&buf, pb, true)
	return buf.String()
}
268128
func (w *WriteContext) WriteMessage(msg proto.Message) error {
	if DebugWire {
		fmt.Printf("<< %s %+v\n", reflect.TypeOf(msg).Elem().Name(), msg)
	}

	buf, err := proto.Marshal(msg)
	if err != nil {
		return errors.WithStack(err)
	}

	vibuflen := binary.PutUvarint(w.varintBuffer, uint64(len(buf)))
	if err != nil {
		return errors.WithStack(err)
	}
	_, err = w.writer.Write(w.varintBuffer[:vibuflen])
	if err != nil {
		return errors.WithStack(err)
	}

	_, err = w.writer.Write(buf)
	if err != nil {
		return errors.WithStack(err)
	}

	return nil
}
344093
func (c *Client) SendText(data string) (err error) {
	return c.Conn.WriteMessage(websocket.TextMessage, []byte(data))
}
9810
func (ctx *Context) WriteString(content string) (int, error) {
	return io.WriteString(ctx.ResponseWriter, content)
}
313956
func (cs CallStack) MarshalText() ([]byte, error) {
	buf := bytes.Buffer{}
	buf.Write(openBracketBytes)
	for i, pc := range cs {
		if i > 0 {
			buf.Write(spaceBytes)
		}
		fmt.Fprint(&buf, pc)
	}
	buf.Write(closeBracketBytes)
	return buf.Bytes(), nil
}
507646
func NewClientCodec(conn io.ReadWriteCloser) core.ClientCodec {
	return NewCodec(true, true, conn)
}