Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 276 for buf1 (0.02 sec)

  1. android/guava/src/com/google/common/io/ByteSource.java

        checkNotNull(other);
    
        byte[] buf1 = createBuffer();
        byte[] buf2 = createBuffer();
    
        Closer closer = Closer.create();
        try {
          InputStream in1 = closer.register(openStream());
          InputStream in2 = closer.register(other.openStream());
          while (true) {
            int read1 = ByteStreams.read(in1, buf1, 0, buf1.length);
            int read2 = ByteStreams.read(in2, buf2, 0, buf2.length);
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 26.2K bytes
    - Viewed (0)
  2. src/bufio/bufio_test.go

    }
    
    func TestWriterReset(t *testing.T) {
    	var buf1, buf2, buf3, buf4, buf5 strings.Builder
    	w := NewWriter(&buf1)
    	w.WriteString("foo")
    
    	w.Reset(&buf2) // and not flushed
    	w.WriteString("bar")
    	w.Flush()
    	if buf1.String() != "" {
    		t.Errorf("buf1 = %q; want empty", buf1.String())
    	}
    	if buf2.String() != "bar" {
    		t.Errorf("buf2 = %q; want bar", buf2.String())
    	}
    
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Fri Nov 01 21:52:12 UTC 2024
    - 51.6K bytes
    - Viewed (0)
  3. src/bytes/bytes_test.go

    		for i := 0; i < b.N; i++ {
    			j := IndexRune(buf, needle)
    			if j != n {
    				b.Fatal("bad index", j)
    			}
    		}
    		for i := range buf {
    			buf[i] = '\x00'
    		}
    	}
    }
    
    func BenchmarkEqual(b *testing.B) {
    	b.Run("0", func(b *testing.B) {
    		var buf [4]byte
    		buf1 := buf[0:0]
    		buf2 := buf[1:1]
    		for i := 0; i < b.N; i++ {
    			eq := Equal(buf1, buf2)
    			if !eq {
    				b.Fatal("bad equal")
    			}
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Mon Aug 19 19:09:04 UTC 2024
    - 61.2K bytes
    - Viewed (0)
  4. src/bytes/example_test.go

    	var buf bytes.Buffer
    	for i := 0; i < 4; i++ {
    		b := buf.AvailableBuffer()
    		b = strconv.AppendInt(b, int64(i), 10)
    		b = append(b, ' ')
    		buf.Write(b)
    	}
    	os.Stdout.Write(buf.Bytes())
    	// Output: 0 1 2 3
    }
    
    func ExampleBuffer_Cap() {
    	buf1 := bytes.NewBuffer(make([]byte, 10))
    	buf2 := bytes.NewBuffer(make([]byte, 0, 10))
    	fmt.Println(buf1.Cap())
    	fmt.Println(buf2.Cap())
    	// Output:
    	// 10
    	// 10
    }
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 07 17:22:36 UTC 2024
    - 14.9K bytes
    - Viewed (0)
  5. internal/jwt/parser.go

    	}
    	headerDec := buf[:n]
    	buf = buf[n:]
    
    	alg, _, _, err := jsonparser.Get(headerDec, "alg")
    	if err != nil {
    		return nil, &jwtgo.ValidationError{Inner: err, Errors: jwtgo.ValidationErrorMalformed}
    	}
    
    	n, err = base64DecodeBytes(token[i+1:j], buf)
    	if err != nil {
    		return nil, &jwtgo.ValidationError{Inner: err, Errors: jwtgo.ValidationErrorMalformed}
    	}
    
    	if err = claims.UnmarshalJSON(buf[:n]); err != nil {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue Sep 17 16:45:46 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/io/CharSequenceReaderTest.java

        assertEquals(expected, buf2.toString());
        assertFullyRead(reader);
    
        // read in chunks to fixed CharBuffer
        reader = new CharSequenceReader(charSequence);
        buf2 = CharBuffer.allocate(5);
        builder = new StringBuilder();
        while (reader.read(buf2) != -1) {
          Java8Compatibility.flip(buf2);
          builder.append(buf2);
          Java8Compatibility.clear(buf2);
        }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Sep 06 17:04:31 UTC 2023
    - 6.5K bytes
    - Viewed (0)
  7. cmd/erasure-decode.go

    	startBlock := int64(0)
    	endBlock := totalLength / e.blockSize
    	if totalLength%e.blockSize != 0 {
    		endBlock++
    	}
    
    	var bufs [][]byte
    	for block := startBlock; block < endBlock; block++ {
    		var err error
    		bufs, err = reader.Read(bufs)
    		if len(bufs) > 0 {
    			if errors.Is(err, errFileNotFound) || errors.Is(err, errFileCorrupt) {
    				if derr == nil {
    					derr = err
    				}
    			}
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Thu Aug 29 01:40:52 UTC 2024
    - 9.5K bytes
    - Viewed (0)
  8. src/archive/zip/writer_test.go

    	r, err := NewReader(bytes.NewReader(buf.Bytes()), int64(buf.Len()))
    	if err != nil {
    		t.Fatal(err)
    	}
    	for i, wt := range writeTests {
    		testReadFile(t, r.File[i], &wt)
    	}
    }
    
    func TestWriterFlush(t *testing.T) {
    	var buf bytes.Buffer
    	w := NewWriter(struct{ io.Writer }{&buf})
    	_, err := w.Create("foo")
    	if err != nil {
    		t.Fatal(err)
    	}
    	if buf.Len() > 0 {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Mon Sep 23 14:32:33 UTC 2024
    - 14.4K bytes
    - Viewed (0)
  9. internal/handlers/forwarder.go

    type bufPool struct {
    	sz   int
    	pool sync.Pool
    }
    
    func (b *bufPool) Put(buf []byte) {
    	if cap(buf) < b.sz || cap(buf) > b.sz*2 {
    		// Buffer too small or will likely leak memory after being expanded.
    		// Drop it.
    		return
    	}
    	b.pool.Put(&buf)
    }
    
    func (b *bufPool) Get() []byte {
    	bufp := b.pool.Get().(*[]byte)
    	return (*bufp)[:b.sz]
    }
    
    func newBufPool(sz int) httputil.BufferPool {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri Apr 07 05:42:10 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  10. guava/src/com/google/common/io/ByteStreams.java

          byte[] buf = new byte[min(bufSize, MAX_ARRAY_LEN - totalLen)];
          bufs.add(buf);
          int off = 0;
          while (off < buf.length) {
            // always OK to fill buf; its size plus the rest of bufs is never more than MAX_ARRAY_LEN
            int r = in.read(buf, off, buf.length - off);
            if (r == -1) {
              return combineBuffers(bufs, totalLen);
            }
            off += r;
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 29.7K bytes
    - Viewed (0)
Back to top