MCPcopy
hub / github.com/pquerna/ffjson / WriteRune

Method WriteRune

fflib/v1/buffer.go:290–298  ·  view source on GitHub ↗

WriteRune appends the UTF-8 encoding of Unicode code point r to the buffer, returning its length and an error, which is always nil but is included to match bufio.Writer's WriteRune. The buffer is grown as needed; if it becomes too large, WriteRune will panic with ErrTooLarge.

(r rune)

Source from the content-addressed store, hash-verified

288// included to match bufio.Writer's WriteRune. The buffer is grown as needed;
289// if it becomes too large, WriteRune will panic with ErrTooLarge.
290func (b *Buffer) WriteRune(r rune) (n int, err error) {
291 if r < utf8.RuneSelf {
292 b.WriteByte(byte(r))
293 return 1, nil
294 }
295 n = utf8.EncodeRune(b.runeBytes[0:], r)
296 b.Write(b.runeBytes[0:n])
297 return n, nil
298}
299
300// Read reads the next len(p) bytes from the buffer or until the buffer
301// is drained. The return value n is the number of bytes read. If the

Callers

nothing calls this directly

Calls 2

WriteByteMethod · 0.95
WriteMethod · 0.95

Tested by

no test coverage detected