Write appends a byte slice into the view's internal buffer. Because View implements the io.Writer interface, it can be passed as parameter of functions like fmt.Fprintf, fmt.Fprintln, io.Copy, etc. Clear must be called to clear the view's buffer.
(p []byte)
| 783 | // of functions like fmt.Fprintf, fmt.Fprintln, io.Copy, etc. Clear must |
| 784 | // be called to clear the view's buffer. |
| 785 | func (v *View) Write(p []byte) (n int, err error) { |
| 786 | v.writeMutex.Lock() |
| 787 | defer v.writeMutex.Unlock() |
| 788 | |
| 789 | v.write(p) |
| 790 | |
| 791 | return len(p), nil |
| 792 | } |
| 793 | |
| 794 | func (v *View) write(p []byte) { |
| 795 | v.tainted = true |
no test coverage detected