// Data writes some data into the body stream and updates the HTTP code.
433016
func (c *Context) Data(code int, contentType string, data []byte) {
	c.Render(code, render.Data{
		ContentType: contentType,
		Data:        data,
	})
}
249648
func (w *responseWriter) Flush() {
	w.WriteHeaderNow()
	w.ResponseWriter.(http.Flusher).Flush()
}
418023
func (b *Bytes) Write(data []byte) (n int, err error) {
	b.bytes, n, err = b.write(data)
	return n, err
}
496207
func (h *JSONWriter) Write(w http.ResponseWriter, r *http.Request, e interface{}) {
	h.WriteCode(w, r, http.StatusOK, e)
}
180626
func Bytes(w http.ResponseWriter, code int, bs []byte) {
	w.WriteHeader(code)
	if code == 204 {
		return
	}
	w.Write(bs)
}
1360181
func (res *MCResponse) Bytes() []byte {
	data := make([]byte, res.Size())

	pos := res.fillHeaderBytes(data)

	copy(data[pos:pos+len(res.Body)], res.Body)

	return data
}
74069
func (crw *customResponseWriter) Write(body []byte) (int, error) {
	if crw.written {
		LOGHANDLER.Warn(errMultiWrite)
		return 0, nil
	}

	crw.written = true
	return crw.ResponseWriter.Write(body)
}
430259
func (i *ImageSurface) Data() []byte {
	buf := C.cairo_image_surface_get_data(i.Ptr)
	return C.GoBytes(unsafe.Pointer(buf), C.int(i.GetStride()*i.GetHeight()))
}
1350340
func (w *http2responseWriter) Write(buf []byte) (int, error) {
	atomic.CompareAndSwapInt32(w.code, 0, int32(http.StatusOK))
	return w.ResponseWriter.Write(buf)
}
1171083
func (pd *pingData) data() (float64, float64) {
	if pd.updated {
		pd.Lock()

		// Calculate the mean
		var accumulator float64
		for _, d := range pd.pings {
			accumulator += float64(d)
		}
		pd.lastMean = accumulator / float64(len(pd.pings))

		// Subtract the mean and square the result; calculcate the mean
		accumulator = 0.0 // Reusing accumulator.
		for _, d := range pd.pings {
			diff := pd.lastMean - float64(d)
			accumulator += math.Pow(diff, 2.0)
		}
		squareDiffMean := accumulator / float64(len(pd.pings))

		// Sqrt the square diffs mean and we have our stddev
		pd.lastStddev = math.Sqrt(squareDiffMean)

		pd.updated = false

		pd.Unlock()
	}

	return pd.lastMean, pd.lastStddev
}
887570
func (c *Context) WriteData(data interface{}) (err error) {
	var bytes []byte
	if bytes, err = c.Serialize(data); err == nil {
		_, err = c.Write(bytes)
	}
	return
}
1116581
func (e *Event) Data() ([]byte, error) {
	if e.Type != BinaryMessage {
		return nil, errors.New("Event.Text() called on non-BinaryMessage event")
	}
	return ioutil.ReadAll(e)
}
199632
func (s *Stream) Write(data []byte) (int, error) {
	var err C.int
	_ = C.pa_simple_write(
		s.simple,
		unsafe.Pointer(&data[0]),
		C.size_t(len(data)),
		&err,
	)
	// pulse simple does not return the number of bytes written,
	// so we must assume that all is written on success,
	// and nothing is written on failure.
	if err == C.PA_OK {
		return len(data), nil
	}
	return 0, errorFromCode(err)
}
980476
func Body(r *http.Request, v interface{}) error {
	if err := json.NewDecoder(r.Body).Decode(v); err != nil {
		return err
	}
	return Validate.StructCtx(r.Context(), v)
}
887380
func (stream *OdbWriteStream) Write(data []byte) (int, error) {
	header := (*reflect.SliceHeader)(unsafe.Pointer(&data))
	ptr := (*C.char)(unsafe.Pointer(header.Data))
	size := C.size_t(header.Len)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_odb_stream_write(stream.ptr, ptr, size)
	runtime.KeepAlive(stream)
	if ret < 0 {
		return 0, MakeGitError(ret)
	}

	return len(data), nil
}
1237602
func (o *OutResponse) Write(data []byte) (int, error) {
	return o.response.GetWriter().Write(data)
}
1041190
func (r *Render) Data(w io.Writer, status int, v []byte) error {
	head := Head{
		ContentType: r.opt.BinaryContentType,
		Status:      status,
	}

	d := Data{
		Head: head,
	}

	return r.Render(w, d, v)
}