NewMultiAt returns a BufferAt which is the logical concatenation of the passed BufferAts. The data in the buffers is shifted such that there is no non-empty buffer following a non-full buffer, this process is also run after every Read. If no buffers are passed, the returned Buffer is nil.
(buffers ...BufferAt)
| 34 | // a non-full buffer, this process is also run after every Read. |
| 35 | // If no buffers are passed, the returned Buffer is nil. |
| 36 | func NewMultiAt(buffers ...BufferAt) BufferAt { |
| 37 | if len(buffers) == 0 { |
| 38 | return nil |
| 39 | } else if len(buffers) == 1 { |
| 40 | return buffers[0] |
| 41 | } |
| 42 | |
| 43 | buf := &chain{ |
| 44 | Buf: buffers[0], |
| 45 | Next: NewMultiAt(buffers[1:]...), |
| 46 | } |
| 47 | |
| 48 | buf.Defrag() |
| 49 | |
| 50 | return buf |
| 51 | } |
| 52 | |
| 53 | // NewMulti returns a Buffer which is the logical concatenation of the passed buffers. |
| 54 | // The data in the buffers is shifted such that there is no non-empty buffer following |
searching dependent graphs…