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

Function NewWriter

zstd/encoder.go:71–88  ·  view source on GitHub ↗

NewWriter will create a new Zstandard encoder. If the encoder will be used for encoding blocks a nil writer can be used.

(w io.Writer, opts ...EOption)

Source from the content-addressed store, hash-verified

69// NewWriter will create a new Zstandard encoder.
70// If the encoder will be used for encoding blocks a nil writer can be used.
71func NewWriter(w io.Writer, opts ...EOption) (*Encoder, error) {
72 initPredefined()
73 var e Encoder
74 e.o.setDefault()
75 for _, o := range opts {
76 err := o(&e.o)
77 if err != nil {
78 return nil, err
79 }
80 }
81 if e.o.concurrentBlocks && (e.o.dict != nil || e.o.concurrent <= 1) {
82 e.o.concurrentBlocks = false
83 }
84 if w != nil {
85 e.Reset(w)
86 }
87 return &e, nil
88}
89
90func (e *Encoder) initialize() {
91 if e.o.concurrent == 0 {

Callers 15

TestTransportZstdFunction · 0.92
BenchmarkTransportFunction · 0.92
newTestHandlerFunction · 0.92
addLevelPoolFunction · 0.92
TestHeader_DecodeFunction · 0.70
FuzzEncodingFunction · 0.70
TestEncoder_SmallDictFunction · 0.70

Calls 3

ResetMethod · 0.95
initPredefinedFunction · 0.85
setDefaultMethod · 0.45

Tested by 15

TestTransportZstdFunction · 0.74
BenchmarkTransportFunction · 0.74
newTestHandlerFunction · 0.74
TestHeader_DecodeFunction · 0.56
FuzzEncodingFunction · 0.56
TestEncoder_SmallDictFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…