// NewWriter creates a new Writer using the given configuration parameters.

NewWriter creates a new Writer using the given configuration parameters.
// NewWriter creates a new Writer using the given configuration parameters .
func (c WriterConfig) NewWriter(xz io.Writer) (w *Writer, err error) {
	if err = c.Verify(); err != nil {
		return nil, err
	}
	w = &Writer{
		WriterConfig: c,
		xz:           xz,
		h:            header{c.CheckSum},
		index:        make([]record, 0, 4),
	}
	if w.newHash, err = newHashFunc(c.CheckSum); err != nil {
		return nil, err
	}
	data, err := w.h.MarshalBinary()
	if _, err = xz.Write(data); err != nil {
		return nil, err
	}
	if err = w.newBlockWriter(); err != nil {
		return nil, err
	}
	return w, nil
}
func ( c WriterConfig ) NewWriter ( xz io . Writer ) ( w * Writer , err error ) { if err = c . Verify ( ) ; err != nil { return nil , err } w = & Writer { WriterConfig : c , xz : xz , h : header { c . CheckSum } , index : make ( [ ] record , 0 , 4 ) , } if w . newHash , err = newHashFunc ( c . CheckSum ) ; err != nil { return nil , err } data , err := w . h . MarshalBinary ( ) if _ , err = xz . Write ( data ) ; err != nil { return nil , err } if err = w . newBlockWriter ( ) ; err != nil { return nil , err } return w , nil }
NewWriter creates a new Writer using the given configuration parameters.
NewWriter creates a new Writer using the given configuration parameters .