// Init initializes the bit Reader to read from r. If bigEndian is true, then
// bits will be read starting from the most-significant bits of a byte
// (as done in bzip2), otherwise it will read starting from the
// least-significant bits of a byte (such as for deflate and brotli).
Init initializes the bit Reader to read from r. If bigEndian is true, then
bits will be read starting from the most-significant bits of a byte
(as done in bzip2), otherwise it will read starting from the
least-significant bits of a byte (such as for deflate and brotli).
// Init initializes the bit Reader to read from r . If bigEndian is true then // bits will be read starting from the most - significant bits of a byte // ( as done in bzip2 ) otherwise it will read starting from the // least - significant bits of a byte ( such as for deflate and brotli ) .
func (pr *Reader) Init(r io.Reader, bigEndian bool) {
	*pr = Reader{rd: r}
	switch rr := r.(type) {
	case *bytes.Buffer:
		pr.bufRd = &buffer{Buffer: rr}
	case *bytes.Reader:
		pr.bufRd = &bytesReader{Reader: rr}
	case *strings.Reader:
		pr.bufRd = &stringReader{Reader: rr}
	case compress.BufferedReader:
		pr.bufRd = rr
	case compress.ByteReader:
		pr.byteRd = rr
	default:
		br := bufio.NewReader(r)
		pr.rd, pr.bufRd = br, br
	}
	if bigEndian {
		copy(pr.transform[:], internal.ReverseLUT[:])
	} else {
		copy(pr.transform[:], internal.IdentityLUT[:])
	}
}
func ( pr * Reader ) Init ( r io . Reader , bigEndian bool ) { * pr = Reader { rd : r } switch rr := r . ( type ) { case * bytes . Buffer : pr . bufRd = & buffer { Buffer : rr } case * bytes . Reader : pr . bufRd = & bytesReader { Reader : rr } case * strings . Reader : pr . bufRd = & stringReader { Reader : rr } case compress . BufferedReader : pr . bufRd = rr case compress . ByteReader : pr . byteRd = rr default : br := bufio . NewReader ( r ) pr . rd , pr . bufRd = br , br } if bigEndian { copy ( pr . transform [ : ] , internal . ReverseLUT [ : ] ) } else { copy ( pr . transform [ : ] , internal . IdentityLUT [ : ] ) } }
Init initializes the bit Reader to read from r. If bigEndian is true, then
bits will be read starting from the most-significant bits of a byte
(as done in bzip2), otherwise it will read starting from the
least-significant bits of a byte (such as for deflate and brotli).
Init initializes the bit Reader to read from r . If bigEndian is true then bits will be read starting from the most - significant bits of a byte ( as done in bzip2 ) otherwise it will read starting from the least - significant bits of a byte ( such as for deflate and brotli ) .