// NewReader creates a new reader for an LZMA stream in the classic
// format. The function reads and verifies the the header of the LZMA
// stream.
NewReader creates a new reader for an LZMA stream in the classic
format. The function reads and verifies the the header of the LZMA
stream.
// NewReader creates a new reader for an LZMA stream in the classic // format . The function reads and verifies the the header of the LZMA // stream .
func (c ReaderConfig) NewReader(lzma io.Reader) (r *Reader, err error) {
	if err = c.Verify(); err != nil {
		return nil, err
	}
	data := make([]byte, HeaderLen)
	if _, err := io.ReadFull(lzma, data); err != nil {
		if err == io.EOF {
			return nil, errors.New("lzma: unexpected EOF")
		}
		return nil, err
	}
	r = &Reader{lzma: lzma}
	if err = r.h.unmarshalBinary(data); err != nil {
		return nil, err
	}
	if r.h.dictCap < MinDictCap {
		return nil, errors.New("lzma: dictionary capacity too small")
	}
	dictCap := r.h.dictCap
	if c.DictCap > dictCap {
		dictCap = c.DictCap
	}
	state := newState(r.h.properties)
	dict, err := newDecoderDict(dictCap)
	if err != nil {
		return nil, err
	}
	r.d, err = newDecoder(ByteReader(lzma), state, dict, r.h.size)
	if err != nil {
		return nil, err
	}
	return r, nil
}
func ( c ReaderConfig ) NewReader ( lzma io . Reader ) ( r * Reader , err error ) { if err = c . Verify ( ) ; err != nil { return nil , err } data := make ( [ ] byte , HeaderLen ) if _ , err := io . ReadFull ( lzma , data ) ; err != nil { if err == io . EOF { return nil , errors . New ( " " ) } return nil , err } r = & Reader { lzma : lzma } if err = r . h . unmarshalBinary ( data ) ; err != nil { return nil , err } if r . h . dictCap < MinDictCap { return nil , errors . New ( " " ) } dictCap := r . h . dictCap if c . DictCap > dictCap { dictCap = c . DictCap } state := newState ( r . h . properties ) dict , err := newDecoderDict ( dictCap ) if err != nil { return nil , err } r . d , err = newDecoder ( ByteReader ( lzma ) , state , dict , r . h . size ) if err != nil { return nil , err } return r , nil }
NewReader creates a new reader for an LZMA stream in the classic
format.
NewReader creates a new reader for an LZMA stream in the classic format .