//Dump - will dump the output of a executed command to the given writer
549582
func (s *NFSBackup) Dump(dest io.Writer) (err error) {
	err = s.Caller.Execute(dest, s.getDumpCommand())
	return
}
1059984
func (c Config) Dump(buf []byte) string {
	N := c.Width
	var out bytes.Buffer
	rowIndex := 0
	maxRowWidth := 0
	for rowIndex*N < len(buf) {
		a, b := rowIndex*N, (rowIndex+1)*N
		if b > len(buf) {
			b = len(buf)
		}
		row := buf[a:b]
		hex, ascii := printable(row)

		if len(row) < maxRowWidth {
			padding := maxRowWidth*2 + maxRowWidth/4 - len(row)*2 - len(row)/4
			hex += strings.Repeat(" ", padding)
		}
		maxRowWidth = len(row)

		fmt.Fprintf(&out, "%5d: %s | %s\n", a, hex, ascii)
		rowIndex++
	}
	return out.String()
}
23723
func Stdout() io.Writer {
	stdout := colorable.NewColorableStdout()
	if stdout == os.Stdout {
		return os.Stdout
	}

	return &WinColorTerminal{output: stdout}
}
181199
func Output(w io.Writer) ServiceOption {
	return func(s *Service) error {
		s.output = w
		return nil
	}
}
1176250
func (s *Session) Output(cmd string) ([]byte, error) {
	if s.Stdout != nil {
		return nil, errors.New("ssh: Stdout already set")
	}
	var b bytes.Buffer
	s.Stdout = &b
	err := s.Run(cmd)
	return b.Bytes(), err
}
212297
func (n *NatEntry6) Dump(key tuple.TupleKey, start uint64) string {
	var which string

	if key.GetFlags()&tuple.TUPLE_F_IN != 0 {
		which = "DST"
	} else {
		which = "SRC"
	}
	return fmt.Sprintf("XLATE_%s [%s]:%d Created=%s HostLocal=%d\n",
		which,
		n.Addr,
		n.Port,
		NatDumpCreated(start, n.Created),
		n.HostLocal)
}
500714
func (w *Writer) Write(data []byte) (n int, err error) {
	if w.writer == nil {
		if w.filename == "" {
			w.writer = os.Stdout
			w.filename = os.Stdout.Name()
		} else {
			file, err := os.Create(w.filename)
			if err != nil {
				return 0, err
			}
			w.writer = file
		}
	}
	return w.writer.Write(data)
}
1249469
func Dump(t T, resp *http.Response) {
	// dump request
	var buffer bytes.Buffer
	buffer.WriteString("\n")
	buffer.WriteString(fmt.Sprintf("%v %v\n", resp.Request.Method, resp.Request.URL))
	for k, v := range resp.Request.Header {
		if IsMaskedHeader(k) {
			v = []string{strings.Repeat(MaskChar, len(v[0]))}
		}
		if len(k) > 0 {
			buffer.WriteString(fmt.Sprintf("%s : %v\n", k, strings.Join(v, ",")))
		}
	}
	// dump request payload, only available is there is a Body.
	if resp != nil && resp.Request != nil && resp.Request.Body != nil {
		rc, err := resp.Request.GetBody()
		body, err := ioutil.ReadAll(rc)
		if err != nil {
			buffer.WriteString(fmt.Sprintf("unable to read request body:%v", err))
		} else {
			if len(body) > 0 {
				buffer.WriteString("\n")
			}
			buffer.WriteString(string(body))
			buffer.WriteString("\n")
		}
	}
	// dump response payload
	if resp == nil {
		buffer.WriteString("-- no response --")
		Logf(t, buffer.String())
		return
	}
	buffer.WriteString(fmt.Sprintf("\n%s\n", resp.Status))
	for k, v := range resp.Header {
		if len(k) > 0 {
			buffer.WriteString(fmt.Sprintf("%s : %v\n", k, strings.Join(v, ",")))
		}
	}
	if resp.Body != nil {
		body, err := ioutil.ReadAll(resp.Body)
		if err != nil {
			if resp.StatusCode/100 == 3 {
				// redirect closes body ; nothing to read
				buffer.WriteString("\n")
			} else {
				buffer.WriteString(fmt.Sprintf("unable to read response body:%v", err))
			}
		} else {
			if len(body) > 0 {
				buffer.WriteString("\n")
			}
			buffer.WriteString(string(body))
		}
		resp.Body.Close()
		// put the body back for re-reads
		resp.Body = ioutil.NopCloser(bytes.NewReader(body))
	}
	buffer.WriteString("\n")
	Logf(t, buffer.String())
}
100181
func (o Options) Dump(values ...interface{}) {
	for i, value := range values {
		state := newDumpState(value, &o, os.Stdout)
		if i > 0 {
			state.w.Write([]byte(o.Separator))
		}
		state.dump(value)
	}
	os.Stdout.Write([]byte("\n"))
}
716650
func (oc *OutputChannel) Flush() {
	for {
		select {
		case msg := <-oc.input:
			if err := oc.output.Write(msg); err != nil {
				critialLogger.Print("cannot write log message: ", err.Error())
			}
		default:
			return
		}
	}
}
741888
func (db *DB) Dump(dest string) error {
	db.schemaLock.Lock()
	defer db.schemaLock.Unlock()
	cpFun := func(currPath string, info os.FileInfo, err error) error {
		if err != nil {
			return err
		}
		if info.IsDir() {
			relPath, err := filepath.Rel(db.path, currPath)
			if err != nil {
				return err
			}
			destDir := path.Join(dest, relPath)
			if err := os.MkdirAll(destDir, 0700); err != nil {
				return err
			}
			tdlog.Noticef("Dump: created directory %s", destDir)
		} else {
			src, err := os.Open(currPath)
			if err != nil {
				return err
			}
			relPath, err := filepath.Rel(db.path, currPath)
			if err != nil {
				return err
			}
			destPath := path.Join(dest, relPath)
			if _, fileExists := os.Open(destPath); fileExists == nil {
				return fmt.Errorf("Destination file %s already exists", destPath)
			}
			destFile, err := os.Create(destPath)
			if err != nil {
				return err
			}
			written, err := io.Copy(destFile, src)
			if err != nil {
				return err
			}
			_ = destFile.Close()
			_ = src.Close()
			tdlog.Noticef("Dump: copied file %s, size is %d", destPath, written)
		}
		return nil
	}
	return filepath.Walk(db.path, cpFun)
}
190339
func Output(out io.Writer) Option {
	return func(l *handler) {
		l.out = out
	}
}
906315
func (g *generator) Output() []byte {
	src, err := format.Source(g.buf.Bytes())
	if err != nil {
		log.Fatalf("Failed to format generated source code: %s\n%s", err, g.buf.String())
	}
	return src
}
145689
func Dump(socket *zmq.Socket) {

	fmt.Println("----------------------------------------")

	parts, err := socket.Recv()
	if err != nil {
		fmt.Println(err)
		return
	}

	for _, msg := range parts {
		var binary bool
		for _, x := range msg {
			if x < 32 || x > 127 {
				binary = true
				break
			}
		}

		// Dump the message as text or binary
		fmt.Printf("[%03d] ", len(msg))

		if binary {
			fmt.Printf("% X\n", msg)
		} else {
			fmt.Println(string(msg))
		}
	}
}
186955
func (c *ExecCommand) Stdout() (io.WriteCloser, error) {
	if c.stdout == nil {
		if c.StdoutPath != "" {
			f, err := fifo.OpenWriter(c.StdoutPath)
			if err != nil {
				return nil, fmt.Errorf("failed to create stdout: %v", err)
			}
			c.stdout = f
		} else {
			c.stdout = nopCloser{ioutil.Discard}
		}
	}
	return c.stdout, nil
}
377950
func (c *Client) Dump(key string) (string, error) {
	v, err := c.execWithKey(true, "DUMP", key)
	if err != nil {
		return "", err
	}
	return iface2str(v)
}
30601
func (g *Generator) Write(output string) {
	if err := ioutil.WriteFile(output, g.buf.Bytes(), 0644); err != nil {
		log.Fatalln(err)
	}
}