- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for ReadDataAt (0.09 sec)
-
src/internal/saferio/io_test.go
input := bytes.Repeat([]byte{'a'}, count) t.Run("small", func(t *testing.T) { got, err := ReadDataAt(bytes.NewReader(input), count, 0) if err != nil { t.Fatal(err) } if !bytes.Equal(got, input) { t.Errorf("got %v, want %v", got, input) } }) t.Run("large", func(t *testing.T) { _, err := ReadDataAt(bytes.NewReader(input), 10<<30, 0) if err == nil { t.Error("large read succeeded unexpectedly")
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Aug 31 00:34:05 UTC 2023 - 3.1K bytes - Viewed (0) -
src/internal/saferio/io.go
return nil, err } buf = append(buf, buf1[:next]...) n -= next } return buf, nil } // ReadDataAt reads n bytes from the input stream at off, but avoids // allocating all n bytes if n is large. This avoids crashing the program // by allocating all n bytes in cases where n is incorrect. func ReadDataAt(r io.ReaderAt, n uint64, off int64) ([]byte, error) { if int64(n) < 0 || n != uint64(int(n)) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Aug 31 00:34:05 UTC 2023 - 3.4K bytes - Viewed (0) -
src/debug/pe/section.go
// Data reads and returns the contents of the PE section s. // // If s.Offset is 0, the section has no contents, // and Data will always return a non-nil error. func (s *Section) Data() ([]byte, error) { return saferio.ReadDataAt(s.sr, uint64(s.Size), 0) } // Open returns a new ReadSeeker reading the PE section s. // // If s.Offset is 0, the section has no contents, and all calls // to the returned reader will return a non-nil error.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 18 19:33:30 UTC 2023 - 3.5K bytes - Viewed (0) -
src/debug/plan9obj/file.go
// with other clients. io.ReaderAt sr *io.SectionReader } // Data reads and returns the contents of the Plan 9 a.out section. func (s *Section) Data() ([]byte, error) { return saferio.ReadDataAt(s.sr, uint64(s.Size), 0) } // Open returns a new ReadSeeker reading the Plan 9 a.out section. func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 18 19:33:30 UTC 2023 - 7.2K bytes - Viewed (0)