Materialize concatenates all the underlying Buffer's data into a single contiguous buffer using CopyTo.
()
| 87 | // Materialize concatenates all the underlying Buffer's data into a single |
| 88 | // contiguous buffer using CopyTo. |
| 89 | func (s BufferSlice) Materialize() []byte { |
| 90 | l := s.Len() |
| 91 | if l == 0 { |
| 92 | return nil |
| 93 | } |
| 94 | out := make([]byte, l) |
| 95 | s.CopyTo(out) |
| 96 | return out |
| 97 | } |
| 98 | |
| 99 | // MaterializeToBuffer functions like Materialize except that it writes the data |
| 100 | // to a single Buffer pulled from the given BufferPool. |