Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for LimitWriter (0.77 sec)

  1. pkg/kubelet/util/ioutils/ioutils.go

    limitations under the License.
    */
    
    package ioutils
    
    import "io"
    
    // LimitWriter is a copy of the standard library ioutils.LimitReader,
    // applied to the writer interface.
    // LimitWriter returns a Writer that writes to w
    // but stops with EOF after n bytes.
    // The underlying implementation is a *LimitedWriter.
    func LimitWriter(w io.Writer, n int64) io.Writer { return &LimitedWriter{w, n} }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jan 16 12:00:49 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  2. src/net/http/cgi/integration_test.go

    type customWriterRecorder struct {
    	w io.Writer
    	*httptest.ResponseRecorder
    }
    
    func (r *customWriterRecorder) Write(p []byte) (n int, err error) {
    	return r.w.Write(p)
    }
    
    type limitWriter struct {
    	w io.Writer
    	n int
    }
    
    func (w *limitWriter) Write(p []byte) (n int, err error) {
    	if len(p) > w.n {
    		p = p[:w.n]
    	}
    	if len(p) > 0 {
    		n, err = w.w.Write(p)
    		w.n -= n
    	}
    	if w.n == 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 07 18:42:44 UTC 2023
    - 5.5K bytes
    - Viewed (0)
  3. pkg/kubelet/util/ioutils/ioutils_test.go

    		t.Run(fmt.Sprintf("inputSize=%d limit=%d writes=%d", test.inputSize, test.limit, test.writeSize), func(t *testing.T) {
    			input := make([]byte, test.inputSize)
    			r.Read(input)
    			output := &bytes.Buffer{}
    			w := LimitWriter(output, test.limit)
    
    			var (
    				err     error
    				written int64
    				n       int
    			)
    			for written < test.inputSize && err == nil {
    				n, err = w.Write(input[written : written+test.writeSize])
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Sep 11 13:52:28 UTC 2019
    - 2K bytes
    - Viewed (0)
  4. pkg/probe/exec/exec.go

    // from executing a command. Returns the Result status, command output, and
    // errors if any.
    func (pr execProber) Probe(e exec.Cmd) (probe.Result, string, error) {
    	var dataBuffer bytes.Buffer
    	writer := ioutils.LimitWriter(&dataBuffer, maxReadLength)
    
    	e.SetStderr(writer)
    	e.SetStdout(writer)
    	err := e.Start()
    	if err == nil {
    		err = e.Wait()
    	}
    	data := dataBuffer.Bytes()
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue May 14 08:58:18 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  5. pkg/kubelet/prober/prober_test.go

    		cmd := []string{"/foo", "bar"}
    		exec := prober.newExecInContainer(ctx, container, containerID, cmd, 0)
    
    		var dataBuffer bytes.Buffer
    		writer := ioutils.LimitWriter(&dataBuffer, int64(limit))
    		exec.SetStderr(writer)
    		exec.SetStdout(writer)
    		err := exec.Start()
    		if err == nil {
    			err = exec.Wait()
    		}
    		actualOutput := dataBuffer.Bytes()
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 01 07:17:35 UTC 2023
    - 9.7K bytes
    - Viewed (0)
Back to top