// Write writes node to writer
326601
func Write(w io.Writer, node Node) error {
	return node.output(w)
}
496011
func (w *SyncWriter) Write(b []byte) error {
	if _, err := w.w.Write(b); err != nil {
		return err
	}
	return w.syncFn()
}
37858
func (l *logger) Write(p []byte) (n int, err error) {
	l.locker.Lock()
	for _, w := range l.writers {
		n, err = w.Output().Write(p)
		if err != nil {
			return
		}
	}
	l.locker.Unlock()
	return
}
65371
func (w *Writer) Write(b []byte) error {
	w.Lock()
	defer w.Unlock()

	// TODO(abg): Bounds check?
	binary.BigEndian.PutUint32(w.buff[:], uint32(len(b)))
	if _, err := w.w.Write(w.buff[:]); err != nil {
		return err
	}

	if len(b) == 0 {
		return nil
	}

	_, err := w.w.Write(b)
	return err
}
1142016
func (g *Generator) Write(b []byte) (int, error) {
	return g.body.Write(b)
}
302135
func (aw *Writer) Write(b []byte) (int, error) {
	if aw.closed {
		aw.err = ErrWriteAfterClose
		return 0, aw.err
	}
	var n int
	n, aw.err = aw.w.Write(b)
	if aw.err != nil {
		return n, aw.err
	}
	aw.nb -= int64(n)
	return n, aw.err
}
463352
func (w *LoggoWriter) Write(p []byte) (int, error) {
	w.Logger.Logf(w.Level, "%s", p[:len(p)-1]) // omit trailing newline
	return len(p), nil
}
452792
func (w *Writer) Write(p []byte) (n int, err error) {
	if w.closed {
		return 0, ErrClosed
	}

	overwrite := false
	if int64(len(p)) > w.pending {
		p = p[0:w.pending]
		overwrite = true
	}

	n, err = w.multi.Write(p)
	w.pending -= int64(n)
	if err == nil && overwrite {
		err = ErrOverflow
		return
	}

	return
}
625313
func (b *Bucket) write() []byte {
	// Allocate the appropriate size.
	var n = b.rootNode
	var value = make([]byte, bucketHeaderSize+n.size())

	// Write a bucket header.
	var bucket = (*bucket)(unsafe.Pointer(&value[0]))
	*bucket = *b.bucket

	// Convert byte slice to a fake page and write the root node.
	var p = (*page)(unsafe.Pointer(&value[bucketHeaderSize]))
	n.write(p)

	return value
}
217939
func (wr *Writer) Write(p []byte) (n int, err error) {
	wr.bf.Write(p)
	if bytes.HasSuffix(p, []byte(wr.lastElement)) {
		return wr.writer.Write([]byte(Format(wr.bf.String()) + "\n"))
	}
	return 0, nil
}
297380
func (npw *Writer) Write(buf []byte) (int, error) {
	if npw.closed {
		return 0, fmt.Errorf("write to closed Writer")
	}

	bufOffset := int64(0)
	bytesLeft := int64(len(buf))

	for bytesLeft > 0 {
		blockIndex := npw.offset / BigBlockSize
		blockEnd := (blockIndex + 1) * BigBlockSize

		writeEnd := npw.offset + bytesLeft
		if writeEnd > blockEnd {
			writeEnd = blockEnd
		}

		bytesWritten := writeEnd - npw.offset
		blockBufOffset := npw.offset % BigBlockSize
		copy(npw.blockBuf[blockBufOffset:], buf[bufOffset:bufOffset+bytesWritten])

		if writeEnd%BigBlockSize == 0 {
			err := npw.Pool.Downstream.Store(BlockLocation{FileIndex: npw.FileIndex, BlockIndex: blockIndex}, npw.blockBuf)
			if err != nil {
				return 0, errors.WithStack(err)
			}
		}

		bufOffset += bytesWritten
		npw.offset += bytesWritten
		bytesLeft -= bytesWritten
	}

	return len(buf), nil
}
1119841
func (n *Node) WriteTree(padding ...int) string {
	var indent int
	if len(padding) == 1 {
		indent = padding[0]
	}

	var s string
	if n.val != "" {
		for i := 0; i < indent; i++ {
			s += "  "
		}
		s += n.key + " : " + n.val + "\n"
	} else {
		for i := 0; i < indent; i++ {
			s += "  "
		}
		s += n.key + " :" + "\n"
		for _, nn := range n.nodes {
			s += nn.WriteTree(indent + 1)
		}
	}
	return s
}
301301
func (w *LogWriter) Write(b []byte) (int, error) {
	os.Stdout.Write(b)
	if w.RotatorPipe != nil {
		w.RotatorPipe.Write(b)
	}
	return len(b), nil
}
326122
func (s *syncWriter) Write(p []byte) (n int, err error) {
	s.mu.Lock()
	defer s.mu.Unlock()
	return s.lw.Write(p)
}
329349
func (w *Writer) Write(line string) error {
	if w.DebugCallback != nil {
		w.DebugCallback(line)
	}

	return w.writeCallback(w, line)
}
234441
func (s *WriteService) Write(ctx context.Context, org, bucket platform.ID, r io.Reader) error {
	return s.WriteF(ctx, org, bucket, r)
}
190808
func (bufc *bufConn) Write(b []byte) (int, error) {
	return bufc.conn.Write(b)
}