NewSplitter produces a new Splitter. It may be customized before use by setting its MinSize and SplitBits fields.
()
| 79 | // NewSplitter produces a new Splitter. |
| 80 | // It may be customized before use by setting its MinSize and SplitBits fields. |
| 81 | func NewSplitter() *Splitter { |
| 82 | rs := buzhash32.New() |
| 83 | var zeroes [windowSize]byte |
| 84 | _, _ = rs.Write(zeroes[:]) // initialize the rolling checksum window |
| 85 | |
| 86 | return &Splitter{rs: rs} |
| 87 | } |
| 88 | |
| 89 | // Split consumes the given input stream and hashsplits it, producing an iterator of chunk/level pairs. |
| 90 | // |