Encode encodes a pkt-line with the payload specified and write it to the output stream. If several payloads are specified, each of them will get streamed in their own pkt-lines.
(payloads ...[]byte)
| 54 | // the output stream. If several payloads are specified, each of them |
| 55 | // will get streamed in their own pkt-lines. |
| 56 | func (e *Encoder) Encode(payloads ...[]byte) error { |
| 57 | for _, p := range payloads { |
| 58 | if err := e.encodeLine(p); err != nil { |
| 59 | return err |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | return nil |
| 64 | } |
| 65 | |
| 66 | func (e *Encoder) encodeLine(p []byte) error { |
| 67 | if len(p) > MaxPayloadSize { |