MCPcopy
hub / github.com/klauspost/compress / Write

Method Write

zlib/writer.go:146–163  ·  view source on GitHub ↗

Write writes a compressed form of p to the underlying io.Writer. The compressed bytes are not necessarily flushed until the Writer is closed or explicitly flushed.

(p []byte)

Source from the content-addressed store, hash-verified

144// compressed bytes are not necessarily flushed until the Writer is closed or
145// explicitly flushed.
146func (z *Writer) Write(p []byte) (n int, err error) {
147 if !z.wroteHeader {
148 z.err = z.writeHeader()
149 }
150 if z.err != nil {
151 return 0, z.err
152 }
153 if len(p) == 0 {
154 return 0, nil
155 }
156 n, err = z.compressor.Write(p)
157 if err != nil {
158 z.err = err
159 return
160 }
161 z.digest.Write(p)
162 return
163}
164
165// Flush flushes the Writer to its underlying io.Writer.
166func (z *Writer) Flush() error {

Calls 2

writeHeaderMethod · 0.95
WriteMethod · 0.65