INNER CODE UNIT · Go

newBuffer

boz/kail · buffer.go:16

func newBuffer(source EventSource) buffer {
	return &_buffer{source, new(bytes.Buffer)}
}

func (b *_buffer) process(log []byte) []Event {

	var events []Event

	for end := bytes.IndexRune(log, '\n'); end >= 0 && len(log) > 0; end = bytes.IndexRune(log, '\n') {
		var ebuf []byte

		if plen := b.prev.Len(); plen > 0 {
			ebuf = make([]byte, plen+end)
			copy(ebuf, b.prev.Bytes())
			copy(ebuf[plen:], log[:end])
			b.prev.Reset()
		} else {
			ebuf = make([]byte, end)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…