MCPcopy
hub / github.com/docker/compose / Write

Method Write

pkg/utils/writer.go:38–53  ·  pkg/utils/writer.go::splitWriter.Write

Write implements io.Writer. joins all input, splits on the separator and yields each chunk

(b []byte)

Source from the content-addressed store, hash-verified

36
37// Write implements io.Writer. joins all input, splits on the separator and yields each chunk
38func (s *splitWriter) Write(b []byte) (int, error) {
39 n, err := s.buffer.Write(b)
40 if err != nil {
41 return n, err
42 }
43 for {
44 b = s.buffer.Bytes()
45 index := bytes.Index(b, []byte{'\n'})
46 if index < 0 {
47 break
48 }
49 line := s.buffer.Next(index + 1)
50 s.consumer(string(line[:len(line)-1]))
51 }
52 return n, nil
53}
54
55func (s *splitWriter) Close() error {
56 b := s.buffer.Bytes()

Callers 5

writeComposeFileFunction · 0.45
writeEnvFileFunction · 0.45
TestSplitWriterFunction · 0.45
PushFunction · 0.45

Calls 1

BytesMethod · 0.80

Tested by 2

TestSplitWriterFunction · 0.36