Exemplo n.º 1
0
func makeBGZFWriter(output io.WriteCloser, compressionLevel int) (io.WriteCloser, error) {
	bgzfWriter, err := bgzf.NewWriterLevel(output, compressionLevel, runtime.GOMAXPROCS(-1))
	if err != nil {
		return nil, ErrInvalidCompressionLevel
	}
	return bgzfWriter, nil
}
Exemplo n.º 2
0
func (c *Compressor) BenchmarkBGZFWriter(b *testing.B) {
	cw, _ := bgzf.NewWriterLevel(c.w, flate.BestSpeed, runtime.NumCPU())
	b.ResetTimer()

	_, err := io.Copy(cw, c.r)
	if err != nil {
		b.Fatal(err)
	}
	c.w.Sync()
}
Exemplo n.º 3
0
func makeWriter(w io.Writer, level, wc int) (*bgzf.Writer, error) {
	if bw, ok := w.(*bgzf.Writer); ok {
		return bw, nil
	}
	return bgzf.NewWriterLevel(w, level, wc)
}