• Rob Pike's avatar
    bufio: allow Scanner to accept a user-provided buffer · 13be616e
    Rob Pike authored
    Add Scanner.Buffer, which lets the user give a buffer to
    the scanner and set the maximum token size.
    
    We call it Buffer not SetBuffer for consistency with Split, which
    perhaps should have been called SetSplit; too late regardless.
    
    Both Buffer and Split panic if they are called after Scan. The
    panic in Split is new, but the comment on the method already
    said it needed to be called first, so we might as well add the
    verification while we're doing it for Buffer.
    
    This method allows precise user control of storage.
    
    Fixes #11702.
    
    Change-Id: I80e3d0e3830562fdabd4f7b08f322e1378248c39
    Reviewed-on: https://go-review.googlesource.com/14599Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
    Reviewed-by: 's avatarroger peppe <rogpeppe@gmail.com>
    13be616e
Name
Last commit
Last update
..
bufio.go Loading commit data...
bufio_test.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
scan.go Loading commit data...
scan_test.go Loading commit data...