- Sort Score
- Result 10 results
- Languages All
Results 1 - 9 of 9 for copyBuffer (0.26 sec)
-
src/compress/flate/writer_test.go
copyBuffer := make([]byte, 128) for l := 0; l < 10; l++ { for fail := 1; fail <= 256; fail *= 2 { // Fail after 'fail' writes ew := &errorWriter{N: fail} w, err := NewWriter(ew, l) if err != nil { t.Fatalf("NewWriter: level %d: %v", l, err) } n, err := io.CopyBuffer(w, struct{ io.Reader }{bytes.NewBuffer(in)}, copyBuffer) if err == nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 20 18:41:18 UTC 2020 - 5.4K bytes - Viewed (0) -
src/io/example_test.go
r2 := strings.NewReader("second reader\n") buf := make([]byte, 8) // buf is used here... if _, err := io.CopyBuffer(os.Stdout, r1, buf); err != nil { log.Fatal(err) } // ... reused here also. No need to allocate an extra buffer. if _, err := io.CopyBuffer(os.Stdout, r2, buf); err != nil { log.Fatal(err) } // Output: // first reader // second reader }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 06 15:49:32 UTC 2022 - 5.5K bytes - Viewed (0) -
src/encoding/hex/hex_test.go
output := strings.Repeat(test.enc, multiplier) var buf bytes.Buffer enc := NewEncoder(&buf) r := struct{ io.Reader }{bytes.NewReader(input)} // io.Reader only; not io.WriterTo if n, err := io.CopyBuffer(enc, r, make([]byte, 7)); n != int64(len(input)) || err != nil { t.Errorf("encoder.Write(%q*%d) = (%d, %v), want (%d, nil)", test.dec, multiplier, n, err, len(input)) continue }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 08 19:30:23 UTC 2024 - 7.9K bytes - Viewed (0) -
src/compress/flate/example_test.go
zw.Reset(&b) if _, err := io.CopyBuffer(zw, &r, buf); err != nil { log.Fatal(err) } if err := zw.Close(); err != nil { log.Fatal(err) } // Reset the decompressor and decode to some output stream. if err := zr.(flate.Resetter).Reset(&b, nil); err != nil { log.Fatal(err) } if _, err := io.CopyBuffer(os.Stdout, zr, buf); err != nil { log.Fatal(err) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sat Nov 12 18:42:35 UTC 2016 - 6.5K bytes - Viewed (0) -
src/io/multi.go
for i, r := range mr.readers { var n int64 if subMr, ok := r.(*multiReader); ok { // reuse buffer with nested multiReaders n, err = subMr.writeToWithBuffer(w, buf) } else { n, err = copyBuffer(w, r, buf) } sum += n if err != nil { mr.readers = mr.readers[i:] // permit resume / retry after error return sum, err } mr.readers[i] = nil // permit early GC } mr.readers = nil
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 19 15:49:05 UTC 2022 - 3.3K bytes - Viewed (0) -
pkg/hbone/util.go
bufCap := cap(buf1) buf := buf1[0:bufCap:bufCap] // For netstack: src is a gonet.Conn, doesn't implement WriterTo. Dst is a net.TcpConn - and implements ReadFrom. // CopyBuffered is the actual implementation of Copy and CopyBuffer. // if buf is nil, one is allocated. // Duplicated from io // This will prevent stats from working. // If the reader has a WriteTo method, use it to do the copy. // Avoids an allocation and a copy.
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Tue May 23 17:08:31 UTC 2023 - 3.4K bytes - Viewed (0) -
cmd/bitrot.go
// Read's failed for object with right size, file is corrupt. return err } // Subtract hash length.. left -= int64(n) if left < shardSize { shardSize = left } read, err := io.CopyBuffer(h, io.LimitReader(r, shardSize), *bufp) if err != nil { // Read's failed for object with right size, at different offsets. return errFileCorrupt } left -= read
Registered: Sun Jun 16 00:44:34 UTC 2024 - Last Modified: Tue Jan 30 20:43:25 UTC 2024 - 7.6K bytes - Viewed (0) -
src/mime/multipart/formdata.go
} // os.File.ReadFrom will allocate its own copy buffer if we let io.Copy use it. type writerOnly struct{ io.Writer } remainingSize, err := io.CopyBuffer(writerOnly{file}, p, copyBuf) if err != nil { return nil, err } fh.tmpfile = file.Name() fh.Size = int64(b.Len()) + remainingSize fh.tmpoff = fileOff fileOff += fh.Size
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Mar 21 16:12:35 UTC 2024 - 7.7K bytes - Viewed (0) -
platforms/core-runtime/files/src/main/java/org/gradle/internal/file/ThreadLocalBufferProvider.java
private final ThreadLocal<byte[]> copyBuffers; public ThreadLocalBufferProvider(final int bufferSize) { this.copyBuffers = new ThreadLocal<byte[]>() { @Override protected byte[] initialValue() { return new byte[bufferSize]; } }; } @Override public byte[] getBuffer() { return copyBuffers.get(); }
Registered: Wed Jun 12 18:38:38 UTC 2024 - Last Modified: Fri Sep 22 08:55:52 UTC 2023 - 1.2K bytes - Viewed (0)