func (c ReaderConfig) NewReader(xz io.Reader) (r *Reader, err error) {
	if err = c.Verify(); err != nil {
		return nil, err
	}
	r = &Reader{
		ReaderConfig: c,
		xz:           xz,
	}
	if r.sr, err = c.newStreamReader(xz); err != nil {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
		return nil, err
	}
	return r, nil
}
NewReader creates an xz stream reader. The created reader will be
able to process multiple streams and padding unless a SingleStream
has been set in the reader configuration c.
package xz
import (
	"bytes"
	"errors"
	"fmt"
	"hash"
	"io"
	"github.com/ulikunitz/xz/internal/xlog"
	"github.com/ulikunitz/xz/lzma"
)
type ReaderConfig struct {
	DictCap      int
	SingleStream bool
}
func (c *ReaderConfig) fill() {
	if c.DictCap == 0 {
		c.DictCap = 8 * 1024 * 1024
	}
}
func (c *ReaderConfig) Verify() error {
	if c == nil {
		return errors.New("xz: reader parameters are nil")
	}
	lc := lzma.Reader2Config{DictCap: c.DictCap}
	if err := lc.Verify(); err != nil {
		return err
	}
	return nil
}
type Reader struct {
	ReaderConfig
	xz io.Reader
	sr *streamReader
}
type streamReader struct {
	ReaderConfig
	xz      io.Reader
	br      *blockReader
	newHash func() hash.Hash
	h       header
	index   []record
}
func NewReader(xz io.Reader) (r *Reader, err error) {
	return ReaderConfig{}.NewReader(xz)
}