Beispiel #1
0
func testDecompressStream(input []byte, reader io.Reader, T *testing.T) {
	// Stream decompression - use ridiculously small buffer on purpose to
	// test NEEDS_MORE_INPUT state, cf. https://github.com/kothar/brotli-go/issues/28
	streamUnbro, err := ioutil.ReadAll(dec.NewBrotliReaderSize(reader, 128))
	if err != nil {
		T.Error(err)
	}

	check("Stream decompress", input, streamUnbro, T)
}
Beispiel #2
0
func init() {
	RegisterEncoder(FormatBrotli, "cgo",
		func(w io.Writer, lvl int) io.WriteCloser {
			c := enc.NewBrotliParams()
			c.SetQuality(lvl)
			return enc.NewBrotliWriter(c, w)
		})
	RegisterDecoder(FormatBrotli, "cgo",
		func(r io.Reader) io.ReadCloser {
			return dec.NewBrotliReaderSize(r, 4096)
		})
}