// NewWriter2 creates a new LZMA2 writer using the given configuration.
NewWriter2 creates a new LZMA2 writer using the given configuration.
// NewWriter2 creates a new LZMA2 writer using the given configuration .
func (c Writer2Config) NewWriter2(lzma2 io.Writer) (w *Writer2, err error) {
	if err = c.Verify(); err != nil {
		return nil, err
	}
	w = &Writer2{
		w:      lzma2,
		start:  newState(*c.Properties),
		cstate: start,
		ctype:  start.defaultChunkType(),
	}
	w.buf.Grow(maxCompressed)
	w.lbw = LimitedByteWriter{BW: &w.buf, N: maxCompressed}
	m, err := c.Matcher.new(c.DictCap)
	if err != nil {
		return nil, err
	}
	d, err := newEncoderDict(c.DictCap, c.BufSize, m)
	if err != nil {
		return nil, err
	}
	w.encoder, err = newEncoder(&w.lbw, cloneState(w.start), d, 0)
	if err != nil {
		return nil, err
	}
	return w, nil
}
func ( c Writer2Config ) NewWriter2 ( lzma2 io . Writer ) ( w * Writer2 , err error ) { if err = c . Verify ( ) ; err != nil { return nil , err } w = & Writer2 { w : lzma2 , start : newState ( * c . Properties ) , cstate : start , ctype : start . defaultChunkType ( ) , } w . buf . Grow ( maxCompressed ) w . lbw = LimitedByteWriter { BW : & w . buf , N : maxCompressed } m , err := c . Matcher . new ( c . DictCap ) if err != nil { return nil , err } d , err := newEncoderDict ( c . DictCap , c . BufSize , m ) if err != nil { return nil , err } w . encoder , err = newEncoder ( & w . lbw , cloneState ( w . start ) , d , 0 ) if err != nil { return nil , err } return w , nil }
NewWriter2 creates a new LZMA2 writer using the given configuration.
NewWriter2 creates a new LZMA2 writer using the given configuration .