- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 25 for NewReader (0.18 sec)
-
src/bufio/example_test.go
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() { fmt.Println(len(scanner.Bytes()) == 6) } if err := scanner.Err(); err != nil { fmt.Fprintln(os.Stderr, "shouldn't see an error scanning a string") } // Output: // true
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) -
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 { t.Fatalf("error reading symbols: %v", err)
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) -
src/bytes/reader_test.go
var with, withOut nErr with.n, with.err = io.Copy(discard, NewReader(nil)) withOut.n, withOut.err = io.Copy(discard, justReader{NewReader(nil)}) if with != withOut { t.Errorf("behavior differs: with = %#v; without: %#v", with, withOut) } } // tests that Len is affected by reads, but Size is not. func TestReaderLenSize(t *testing.T) { r := NewReader([]byte("abc")) io.CopyN(io.Discard, r, 1) if r.Len() != 2 {
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Mon Dec 13 18:45:54 GMT 2021 - 8K bytes - Viewed (0) -
src/archive/zip/reader.go
return nil, err } r.f = f return r, err } // NewReader returns a new [Reader] reading from r, which is assumed to // have the given size in bytes. // // If any file inside the archive uses a non-local name // (as defined by [filepath.IsLocal]) or a name containing backslashes // and the GODEBUG environment variable contains `zipinsecurepath=0`, // NewReader returns the reader with an [ErrInsecurePath] error.
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Fri Oct 13 18:36:46 GMT 2023 - 27.7K bytes - Viewed (0) -
src/bufio/bufio_test.go
} } return string(b[0:nb]) } func TestReaderSimple(t *testing.T) { data := "hello world" b := NewReader(strings.NewReader(data)) if s := readBytes(b); s != "hello world" { t.Errorf("simple hello world test failed: got %q", s) } b = NewReader(newRot13Reader(strings.NewReader(data))) if s := readBytes(b); s != "uryyb jbeyq" { t.Errorf("rot13 hello world test failed: got %q", s) } }
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Fri Feb 10 18:56:01 GMT 2023 - 51.5K bytes - Viewed (0) -
src/bytes/reader.go
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Fri Oct 13 17:10:31 GMT 2023 - 3.9K bytes - Viewed (1) -
src/archive/zip/zip_test.go
t.Fatalf("creating file %d: %v", i, err) } } if err := w.Close(); err != nil { t.Fatalf("Writer.Close: %v", err) } s := buf.String() zr, err := NewReader(strings.NewReader(s), int64(len(s))) if err != nil { t.Fatalf("NewReader: %v", err) } if got := len(zr.File); got != nFiles { t.Fatalf("File contains %d files, want %d", got, nFiles) } for i := 0; i < nFiles; i++ {
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Wed Mar 27 18:23:49 GMT 2024 - 19.5K bytes - Viewed (0) -
src/archive/zip/reader_test.go
// zeroes _, err := NewReader(bytes.NewReader(b), size) if err != ErrFormat { t.Errorf("zeroes: error=%v, want %v", err, ErrFormat) } // repeated directoryEndSignatures sig := make([]byte, 4) binary.LittleEndian.PutUint32(sig, directoryEndSignature) for i := 0; i < size-4; i += 4 { copy(b[i:i+4], sig) } _, err = NewReader(bytes.NewReader(b), size) if err != ErrFormat {
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Wed Mar 27 18:23:49 GMT 2024 - 55.3K bytes - Viewed (0) -
src/bytes/example_test.go
// Output: // 'Gjnf oevyyvt naq gur fyvgul tbcure... } func ExampleReader_Len() { fmt.Println(bytes.NewReader([]byte("Hi!")).Len()) fmt.Println(bytes.NewReader([]byte("こんにちは!")).Len()) // Output: // 3 // 16 } func ExampleRepeat() { fmt.Printf("ba%s", bytes.Repeat([]byte("na"), 2)) // Output: banana }
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Mon Mar 04 15:54:40 GMT 2024 - 15K bytes - Viewed (1) -
src/archive/tar/example_test.go
if _, err := tw.Write([]byte(file.Body)); err != nil { log.Fatal(err) } } if err := tw.Close(); err != nil { log.Fatal(err) } // Open and iterate through the files in the archive. tr := tar.NewReader(&buf) for { hdr, err := tr.Next() if err == io.EOF { break // End of archive } if err != nil { log.Fatal(err) } fmt.Printf("Contents of %s:\n", hdr.Name)
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Thu Nov 16 16:54:08 GMT 2017 - 1.4K bytes - Viewed (0)