// DataFromReader writes the specified reader into the body stream and updates the HTTP code.
161743
func (c *Context) DataFromReader(code int, contentLength int64, contentType string, reader io.Reader, extraHeaders map[string]string) {
	c.Render(code, render.Reader{
		Headers:       extraHeaders,
		ContentType:   contentType,
		ContentLength: contentLength,
		Reader:        reader,
	})
}
1230498
func NewRawReader(buf []byte) (reader *RawReader) {
	reader = new(RawReader)
	reader.buf = buf
	return
}
28204
func (b *Bytes) ReadNFrom(n int64, r io.Reader) (m int64, err error) {
	b.bytes, m, err = b.readNFrom(n, r)
	return m, err
}
944545
func LoadFrom(r io.Reader) error {
	envy.Load()
	deets, err := ParseConfig(r)
	if err != nil {
		return err
	}
	for n, d := range deets {
		con, err := NewConnection(d)
		if err != nil {
			log(logging.Warn, "unable to load connection %s: %v", n, err)
			continue
		}
		Connections[n] = con
	}
	return nil
}
518732
func DecoderFor(r io.Reader) Decoder {
	var buf bytes.Buffer
	for _, dec := range []DecoderFactory{
		NewDecoder,
		NewJSONDecoder,
		NewCSVDecoder,
	} {
		rd := io.MultiReader(bytes.NewReader(buf.Bytes()), io.TeeReader(r, &buf))
		if err := dec(rd).Decode(&Result{}); err == nil {
			return dec(io.MultiReader(&buf, r))
		}
	}
	return nil
}
248310
func AddFromReader(r io.Reader, store *Store, name string) error {
	s := bufio.NewScanner(r)
	for s.Scan() {
		rt := []rune(s.Text())
		if len(rt) > 0 {
			store.Add(name, rt)
		}
	}
	return s.Err()
}
663905
func (s *sessionV8) NewDataReader() io.Reader {
	// DataFP is always intitialized, either via new or load functions.
	s.DataFP.Seek(0, os.SEEK_SET)
	return io.Reader(s.DataFP)
}
591918
func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error) {
	b.Lock()
	defer b.Unlock()
	return b.b.ReadFrom(r)
}
515332
func (f *FlowRemoved) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &f.Cookie, &f.Priority, &f.Reason,
		&f.Table, &f.DurationSec, &f.DurationNSec, &f.IdleTimeout,
		&f.HardTimeout, &f.PacketCount, &f.ByteCount, &f.Match,
	)
}
1135270
func (i *RawVInt) ReadFrom(r Reader, l int) error {
	if l < 0 {
		return errorsp.WithStacksAndMessage(ErrBadFormat, "l = %d", l)
	}
	var v RawVInt
	n := uint(0)
	for ; l > 0; l-- {
		b, err := r.ReadByte()
		if err != nil {
			return errorsp.WithStacks(err)
		}
		v |= (RawVInt(b) & 0xff) << n
		n += 8
	}
	*i = v
	return nil
}
1033539
func (t *TablePropNextTables) ReadFrom(r io.Reader) (int64, error) {
	header, _, n, err := yieldTableProp(r, &t.Miss)
	if err != nil {
		return n, err
	}

	t.NextTables = make([]Table, header.Len-tablePropLen)
	padding := makePad(int(header.Len))

	nn, err := encoding.ReadFrom(r, &t.NextTables, padding)
	return n + nn, err
}
1360106
func (d *Decoder) DecodeReader(r io.Reader, v interface{}) error {
	_, ok := v.(unmarshalFaster)
	_, ok2 := v.(json.Unmarshaler)
	if ok || ok2 {
		data, err := ioutil.ReadAll(r)
		if err != nil {
			return err
		}
		defer fflib.Pool(data)
		return d.Decode(data, v)
	}
	dec := json.NewDecoder(r)
	return dec.Decode(v)
}
1236165
func LoadFromReader(reader io.Reader, password []byte) (*KeyStore, error) {
	ks := &KeyStore{
		entries: make(map[string]interface{}),
	}
	err := ks.Parse(reader, password)
	if err != nil {
		return nil, err
	}
	return ks, err
}
1321403
func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error) {
	p := b.B
	nStart := int64(len(p))
	nMax := int64(cap(p))
	n := nStart
	if nMax == 0 {
		nMax = 64
		p = make([]byte, nMax)
	} else {
		p = p[:nMax]
	}
	for {
		if n == nMax {
			nMax *= 2
			bNew := make([]byte, nMax)
			copy(bNew, p)
			p = bNew
		}
		nn, err := r.Read(p[n:])
		n += int64(nn)
		if err != nil {
			b.B = p[:n]
			n -= nStart
			if err == io.EOF {
				return n, nil
			}
			return n, err
		}
	}
}
874099
func (r *Request) ReadFrom(rd io.Reader) (n int64, err error) {
	// On the first step we will read the OpenFlow header, so
	// we could get the total length of the OpenFlow message.
	n, err = r.Header.ReadFrom(rd)
	if err != nil {
		return
	}

	// Decode the protocol version major and minor number to
	// make the request interface more or less friendly.
	r.ProtoMajor = 1
	r.ProtoMinor = int(r.Header.Version - 1)

	// FIXME: wrong for version 2
	r.Proto = fmt.Sprintf("OFP/1.%d", r.ProtoMinor)

	contentlen := int64(r.Header.Len() - headerlen)
	if contentlen < 0 {
		return n, ErrCorruptedHeader
	}

	// Define a buffer to fit the content of the OpenFlow package.
	n, buf := 0, make([]byte, int(contentlen))

	// Read all data the from the stream into the allocated buffer.
	//
	// Due to bufferized nature of the reader, it can take multiple
	// reads from the reader to retrieve the body completely.
	for n < contentlen {
		nn, err := rd.Read(buf[n:])
		if n += int64(nn); err != nil {
			return n + headerlen, err
		}
	}

	r.Body = bytes.NewBuffer(buf)
	r.ContentLength = contentlen
	return n + headerlen, nil
}
662036
func (i *InverseBloomFilter) ReadFrom(stream io.Reader) (int64, error) {
	decoded, capacity, size, err := i.decodeToArray(stream)
	if err != nil {
		return int64(0), err
	}

	// Create []*[]byte and point to each item in decoded
	decodedWithPointers := make([]*[]byte, capacity)
	for p := range decodedWithPointers {
		if len(decoded[p]) == 0 {
			decodedWithPointers[p] = nil
		} else {
			decodedWithPointers[p] = &decoded[p]
		}
	}

	i.array = decodedWithPointers
	i.capacity = uint(capacity)
	return int64(size) + int64(2*binary.Size(uint64(0))), nil
}
889979
func NewBlockFromReader(r io.Reader) (*Block, error) {
	// Deserialize the bytes into a MsgBlock.
	var msgBlock wire.MsgBlock
	err := msgBlock.Deserialize(r)
	if err != nil {
		return nil, err
	}

	b := Block{
		msgBlock:    &msgBlock,
		blockHeight: BlockHeightUnknown,
	}
	return &b, nil
}