(s string)
| 502 | } |
| 503 | |
| 504 | func (b *bufWriter) writeString(s string) { |
| 505 | n := cap(b.buf) - len(b.buf) |
| 506 | if len(s) > n { |
| 507 | b.flush() |
| 508 | if len(s) >= cap(b.buf) { |
| 509 | if _, err := b.file.WriteString(s); err != nil { |
| 510 | log.Fatalf("writing %s: %v", b.name, err) |
| 511 | } |
| 512 | return |
| 513 | } |
| 514 | } |
| 515 | b.buf = append(b.buf, s...) |
| 516 | } |
| 517 | |
| 518 | // offset returns the current write offset. |
| 519 | func (b *bufWriter) offset() uint32 { |