package gojay

const hex = "0123456789abcdef"

// grow grows b's capacity, if necessary, to guarantee space for
// another n bytes. After grow(n), at least n bytes can be written to b
// without another allocation. If n is negative, grow panics.
func ( *Encoder) ( int) {
	if cap(.buf)-len(.buf) <  {
		 := make([]byte, len(.buf), 2*cap(.buf)+)
		copy(, .buf)
		.buf = 
	}
}

// Write appends the contents of p to b's Buffer.
// Write always returns len(p), nil.
func ( *Encoder) ( []byte) {
	.buf = append(.buf, ...)
}

func ( *Encoder) ( byte,  byte) {
	.buf = append(.buf, , )
}

// WriteByte appends the byte c to b's Buffer.
// The returned error is always nil.
func ( *Encoder) ( byte) {
	.buf = append(.buf, )
}

// WriteString appends the contents of s to b's Buffer.
// It returns the length of s and a nil error.
func ( *Encoder) ( string) {
	.buf = append(.buf, ...)
}

func ( *Encoder) ( string) {
	 := len()
	for  := 0;  < ; ++ {
		 := []
		if  >= 0x20 &&  != '\\' &&  != '"' {
			.writeByte()
			continue
		}
		switch  {
		case '\\', '"':
			.writeTwoBytes('\\', )
		case '\n':
			.writeTwoBytes('\\', 'n')
		case '\f':
			.writeTwoBytes('\\', 'f')
		case '\b':
			.writeTwoBytes('\\', 'b')
		case '\r':
			.writeTwoBytes('\\', 'r')
		case '\t':
			.writeTwoBytes('\\', 't')
		default:
			.writeString(`\u00`)
			.writeTwoBytes(hex[>>4], hex[&0xF])
		}
		continue
	}
}