Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for NewScanner (0.17 sec)

  1. src/bufio/example_test.go

    func ExampleScanner_lines() {
    	scanner := bufio.NewScanner(os.Stdin)
    	for scanner.Scan() {
    		fmt.Println(scanner.Text()) // Println will add back the final '\n'
    	}
    	if err := scanner.Err(); err != nil {
    		fmt.Fprintln(os.Stderr, "reading standard input:", err)
    	}
    }
    
    // Return the most recent call to Scan as a []byte.
    func ExampleScanner_Bytes() {
    	scanner := bufio.NewScanner(strings.NewReader("gopher"))
    	for scanner.Scan() {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Oct 23 09:06:30 GMT 2023
    - 4.9K bytes
    - Viewed (0)
  2. src/bufio/scan_test.go

    func TestBadReader(t *testing.T) {
    	scanner := NewScanner(endlessZeros{})
    	for scanner.Scan() {
    		t.Fatal("read should fail")
    	}
    	err := scanner.Err()
    	if err != io.ErrNoProgress {
    		t.Errorf("unexpected error: %v", err)
    	}
    }
    
    func TestScanWordsExcessiveWhiteSpace(t *testing.T) {
    	const word = "ipsum"
    	s := strings.Repeat(" ", 4*smallMaxTokenSize) + word
    	scanner := NewScanner(strings.NewReader(s))
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Sep 22 16:22:42 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  3. src/cmd/addr2line/addr2line_test.go

    	out, err := cmd.CombinedOutput()
    	if err != nil {
    		t.Fatalf("%v: %v\n%s", cmd, err, string(out))
    	}
    	syms := make(map[string]string)
    	scanner := bufio.NewScanner(bytes.NewReader(out))
    	for scanner.Scan() {
    		f := strings.Fields(scanner.Text())
    		if len(f) < 3 {
    			continue
    		}
    		syms[f[2]] = f[0]
    	}
    	if err := scanner.Err(); err != nil {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Feb 21 22:16:54 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  4. src/bufio/scan.go

    	// may need to include, for instance, a newline.
    	MaxScanTokenSize = 64 * 1024
    
    	startBufSize = 4096 // Size of initial allocation for buffer.
    )
    
    // NewScanner returns a new [Scanner] to read from r.
    // The split function defaults to [ScanLines].
    func NewScanner(r io.Reader) *Scanner {
    	return &Scanner{
    		r:            r,
    		split:        ScanLines,
    		maxTokenSize: MaxScanTokenSize,
    	}
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Oct 23 09:06:30 GMT 2023
    - 14.2K bytes
    - Viewed (0)
  5. src/cmd/addr2line/main.go

    	if err != nil {
    		log.Fatal(err)
    	}
    	defer f.Close()
    
    	tab, err := f.PCLineTable()
    	if err != nil {
    		log.Fatalf("reading %s: %v", flag.Arg(0), err)
    	}
    
    	stdin := bufio.NewScanner(os.Stdin)
    	stdout := bufio.NewWriter(os.Stdout)
    
    	for stdin.Scan() {
    		p := stdin.Text()
    		if strings.Contains(p, ":") {
    			// Reverse translate file:line to pc.
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Apr 11 16:34:30 GMT 2022
    - 2.3K bytes
    - Viewed (0)
  6. api/go1.1.txt

    pkg archive/zip, type FileHeader struct, UncompressedSize64 uint64
    pkg bufio, const MaxScanTokenSize = 65536
    pkg bufio, const MaxScanTokenSize ideal-int
    pkg bufio, func NewScanner(io.Reader) *Scanner
    pkg bufio, func ScanBytes([]uint8, bool) (int, []uint8, error)
    pkg bufio, func ScanLines([]uint8, bool) (int, []uint8, error)
    pkg bufio, func ScanRunes([]uint8, bool) (int, []uint8, error)
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Thu Mar 31 20:37:15 GMT 2022
    - 2.6M bytes
    - Viewed (0)
Back to top