Source File
indent.go
Belonging Package
encoding/json
package json
import (
)
func ( *bytes.Buffer, []byte) error {
return compact(, , false)
}
func ( *bytes.Buffer, []byte, bool) error {
:= .Len()
:= newScanner()
defer freeScanner()
:= 0
for , := range {
if && ( == '<' || == '>' || == '&') {
if < {
.Write([:])
}
.WriteString(`\u00`)
.WriteByte(hex[>>4])
.WriteByte(hex[&0xF])
= + 1
if && == 0xE2 && +2 < len() && [+1] == 0x80 && [+2]&^1 == 0xA8 {
if < {
.Write([:])
}
.WriteString(`\u202`)
.WriteByte(hex[[+2]&0xF])
= + 3
}
:= .step(, )
if >= scanSkipSpace {
if == scanError {
break
}
if < {
.Write([:])
}
= + 1
}
}
if .eof() == scanError {
.Truncate()
return .err
}
if < len() {
.Write([:])
}
return nil
}
func ( *bytes.Buffer, , string, int) {
.WriteByte('\n')
.WriteString()
for := 0; < ; ++ {
.WriteString()
}
}
func ( *bytes.Buffer, []byte, , string) error {
:= .Len()
:= newScanner()
defer freeScanner()
:= false
:= 0
for , := range {
.bytes++
:= .step(, )
if == scanSkipSpace {
continue
}
if == scanError {
break
}
if && != scanEndObject && != scanEndArray {
= false
++
newline(, , , )
}
if == scanContinue {
.WriteByte()
continue
}
switch {
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |