// WriteIndent writes an XML header and ce to w.
426218
func (ce *CoordinatesElement) WriteIndent(w io.Writer, prefix, indent string) error {
	return write(w, prefix, indent, ce)
}
1102782
func (s *statusCodeWithoutCloseNotify) WriteHeader(status int) {
	s.status = status
	s.ResponseWriter.WriteHeader(status)
}
693480
func (ref *ShapeRef) IndentedDocstring() string {
	doc := ref.Docstring()
	return strings.Replace(doc, "// ", "//   ", -1)
}
956682
func (n *TreeNode) SetIndent(indent int) *TreeNode {
	n.indent = indent
	return n
}
1122106
func indent(s, prefix string) string {
	return string(indentBytes([]byte(s), []byte(prefix)))
}
871896
func (enc *Encoder) Indent(prefix, indent string) {
	enc.p.prefix = prefix
	enc.p.indent = indent
}
782495
func (crw *customResponseWriter) WriteHeader(code int) {
	if crw.written {
		LOGHANDLER.Warn(errMultiHeaderWrite)
		return
	}

	crw.statusCode = code
	crw.ResponseWriter.WriteHeader(code)
}
1167081
func (r *Response) WriteHeader(code int) {
	r.code = code
	r.rw.WriteHeader(code)
}
325472
func (p Patch) ApplyIndent(doc []byte, indent string) ([]byte, error) {
	var pd container
	if doc[0] == '[' {
		pd = &partialArray{}
	} else {
		pd = &partialDoc{}
	}

	err := json.Unmarshal(doc, pd)

	if err != nil {
		return nil, err
	}

	err = nil

	var accumulatedCopySize int64

	for _, op := range p {
		switch op.kind() {
		case "add":
			err = p.add(&pd, op)
		case "remove":
			err = p.remove(&pd, op)
		case "replace":
			err = p.replace(&pd, op)
		case "move":
			err = p.move(&pd, op)
		case "test":
			err = p.test(&pd, op)
		case "copy":
			err = p.copy(&pd, op, &accumulatedCopySize)
		default:
			err = fmt.Errorf("Unexpected kind: %s", op.kind())
		}

		if err != nil {
			return nil, err
		}
	}

	if indent != "" {
		return json.MarshalIndent(pd, "", indent)
	}

	return json.Marshal(pd)
}
74184
func (r *responseWriterWithStatus) WriteHeader(code int) {
	r.code = code
	r.ResponseWriter.WriteHeader(code)
}
1246812
func (e *etc) Write(target io.Writer, prettyPrint bool) error {
	// Build the nodes tree.
	builder := sml.NewNodeBuilder()
	depth := 0
	err := e.values.DoAllDeep(func(ks []string, v string) error {
		doDepth := len(ks)
		tag := ks[doDepth-1]
		for i := depth; i > doDepth; i-- {
			builder.EndTagNode()
		}
		switch {
		case doDepth > depth:
			builder.BeginTagNode(tag)
			builder.TextNode(v)
			depth = doDepth
		case doDepth == depth:
			builder.EndTagNode()
			builder.BeginTagNode(tag)
			builder.TextNode(v)
		case doDepth < depth:
			builder.EndTagNode()
			builder.BeginTagNode(tag)
			builder.TextNode(v)
			depth = doDepth
		}
		return nil
	})
	if err != nil {
		return err
	}
	for i := depth; i > 0; i-- {
		builder.EndTagNode()
	}
	root, err := builder.Root()
	if err != nil {
		return err
	}
	// Now write the node structure.
	wp := sml.NewStandardSMLWriter()
	wctx := sml.NewWriterContext(wp, target, prettyPrint, "   ")
	return sml.WriteSML(root, wctx)
}
19446
func (w *Writer) Write(data []byte) (n int, err error) {
	// Do not print indentation if there is no data.
	indentBuf := indentationTabs
	if w.UseSpaces {
		indentBuf = indentationSpaces
	}

	for len(data) > 0 {
		var printUntil int
		endsWithNewLine := false

		lineBeginning := !w.insideLine
		if data[0] == '\n' && lineBeginning {
			// This is a blank line. Do not indent it, just print as is.
			printUntil = 1
		} else {
			if lineBeginning {
				// Print indentation.
				w.Writer.Write(indentBuf[:w.Level])
				w.insideLine = true
			}

			lineEnd := bytes.IndexRune(data, '\n')
			if lineEnd < 0 {
				// Print the whole thing.
				printUntil = len(data)
			} else {
				// Print until the newline inclusive.
				printUntil = lineEnd + 1
				endsWithNewLine = true
			}
		}
		toPrint := data[:printUntil]
		data = data[printUntil:]

		// Assertion: none of the runes in toPrint
		// can be newline except the last rune.
		// The last rune is newline iff endsWithNewLine==true.

		m, err := w.Writer.Write(toPrint)
		n += m

		if m == len(toPrint) && endsWithNewLine {
			// We've printed the newline, so we are the line beginning again.
			w.insideLine = false
		}
		if err != nil {
			return n, err
		}
	}
	return n, nil
}
793284
func (f *File) SaveToIndent(filename, indent string) error {
	// Note: Because we are truncating with os.Create,
	// 	so it's safer to save to a temporary file location and rename afte done.
	buf, err := f.writeToBuffer(indent)
	if err != nil {
		return err
	}

	return ioutil.WriteFile(filename, buf.Bytes(), 0666)
}
285699
func (w *indentWriter) Write(b []byte) (int, error) {
	w.indent()
	return w.Buffer.Write(b)
}
483879
func (tw *Writer) WriteHeader(hdr *Header) error {
	return tw.writeHeader(hdr, true)
}
938230
func indentString(s, p string) string {
	var res []byte
	b := []byte(s)
	prefix := []byte(p)
	bol := true
	for _, c := range b {
		if bol && c != '\n' {
			res = append(res, prefix...)
		}
		res = append(res, c)
		bol = c == '\n'
	}
	return string(res)
}
997043
func indent(prepend string, level int, append string) string {
	return fmt.Sprintf("%s%*s%s", prepend, level, "", append)
}