// NewReader creates a new Reader reading from r.
547621
func NewReader(r io.Reader) *Reader {
	return &Reader{r: r, curr: &regFileReader{r, 0}}
}
1341232
func NewReader(e *message.Entity) *Reader {
	mr := e.MultipartReader()
	if mr == nil {
		// Artificially create a multipart entity
		// With this header, no error will be returned by message.NewMultipart
		var h message.Header
		h.Set("Content-Type", "multipart/mixed")
		me, _ := message.NewMultipart(h, []*message.Entity{e})
		mr = me.MultipartReader()
	}

	l := list.New()
	l.PushBack(mr)

	return &Reader{Header{e.Header}, e, l}
}
930940
func NewReader(r io.Reader) *Reader {
	return &Reader{
		r:       r,
		decoded: make([]byte, maxUncompressedChunkLen),
		buf:     make([]byte, MaxEncodedLen(maxUncompressedChunkLen)+checksumSize),
	}
}
392370
func NewWrapReader(r io.ReaderAt, off int64, wrapAt int64) *WrapReader {
	return &WrapReader{
		&wrapper{
			doat:   r.ReadAt,
			off:    (off % wrapAt),
			wrapAt: wrapAt,
		},
	}
}
968514
func NewReader(i io.Reader) (o io.Reader, err error) {
	// Create reader
	r := bufio.NewReader(i)

	// Read first 4 bytes
	var b []byte
	if b, err = r.Peek(4); err != nil {
		err = errors.Wrap(err, "astiunicode: reading first 4 bytes failed")
		return
	}

	// Create transformer
	if bytes.HasPrefix(b, bomHeaderUTF32BE) || bytes.HasPrefix(b, bomHeaderUTF32LE) {
		err = errors.New("astiunicode: UTF32 is not handled yet")
		return
	} else if bytes.HasPrefix(b, bomHeaderUTF16BE) {
		o = transform.NewReader(r, unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM).NewDecoder())
	} else if bytes.HasPrefix(b, bomHeaderUTF16LE) {
		o = transform.NewReader(r, unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewDecoder())
	} else if bytes.HasPrefix(b, bomHeaderUTF8) {
		o = transform.NewReader(r, unicode.UTF8.NewDecoder())
	} else {
		o = r
	}
	return
}
925782
func NewReader(r io.Reader) (*Reader, error) {
	h, _ := NewHeader(nil, nil)
	sr := &Reader{
		r: bufio.NewReader(r),
		h: h,
	}

	var b []byte
	p, err := sr.r.Peek(1)
	if err != nil {
		return nil, err
	}
	if p[0] != '@' {
		sr.seenRefs = make(map[string]*Reference)
		return sr, nil
	}

	for {
		l, err := sr.r.ReadBytes('\n')
		if err != nil {
			return nil, io.ErrUnexpectedEOF
		}
		b = append(b, l...)
		p, err := sr.r.Peek(1)
		if err == io.EOF {
			break
		}
		if err != nil {
			return nil, err
		}
		if p[0] != '@' {
			break
		}
	}

	err = sr.h.UnmarshalText(b)
	if err != nil {
		return nil, err
	}

	return sr, nil
}
1213421
func NewDecoder(r io.Reader) *Decoder {
	return &Decoder{Decoder: *json.NewDecoder(r)}
}
1337815
func NewReader(r io.Reader) *BitReader {
	b := new(BitReader)
	b.r = r
	return b
}
856940
func NewReader(input io.Reader) *Reader {
	return &Reader{
		input: bufio.NewReader(input),
	}
}
1065530
func NewReader(charset int, r io.Reader) io.Reader {
	conv, ok := converters[charset]
	if !ok {
		return nil
	}
	b := bytes.NewBuffer(make([]byte, 1024))
	b.Truncate(0)
	return &LatinReader{reader: r, converter: conv, buf: b}
}
1305070
func NewReader(r io.Reader, uncompressedSize int) (io.ReadCloser, error) {
	if uncompressedSize > windowSize {
		return nil, errors.New("uncompressed size is limited to 32KB")
	}
	f := &decompressor{
		lru:          [3]uint16{1, 1, 1},
		uncompressed: uncompressedSize,
		b:            make([]byte, 4096),
		r:            r,
	}
	return f, nil
}
47799
func newBufReader(rd io.Reader) *bufReader {
	return &bufReader{buf: bufio.NewReader(rd)}
}
1170168
func (g *GcsFS) NewReader(o string) (io.ReadCloser, error) {
	return g.NewReaderWithContext(context.Background(), o)
}
77784
func NewReader(readCloser io.ReadCloser, args *ReaderArgs) *Reader {
	d := jstream.NewDecoder(readCloser, 0).ObjectAsKVS()
	return &Reader{
		args:       args,
		decoder:    d,
		valueCh:    d.Stream(),
		readCloser: readCloser,
	}
}
90403
func NewReader(r io.Reader, contentType string) (io.Reader, error) {
	preview := make([]byte, 1024)
	n, err := io.ReadFull(r, preview)
	switch {
	case err == io.ErrUnexpectedEOF:
		preview = preview[:n]
		r = bytes.NewReader(preview)
	case err != nil:
		return nil, err
	default:
		r = io.MultiReader(bytes.NewReader(preview), r)
	}

	if e, _, _ := DetermineEncoding(preview, contentType); e != encoding.Nop {
		r = transform.NewReader(r, e.NewDecoder())
	}
	return r, nil
}
412770
func NewReader(r io.Reader, limiter Limiter) io.Reader {
	return &reader{r, limiter}
}
367859
func NewReader(config ReaderConfig) (*Reader, error) {
	if err := config.validate(); err != nil {
		return nil, errors.Trace(err)
	}
	r := &Reader{config: config}
	return r, nil
}