Skip to content

Commit

Permalink
(most probably broken) flush support, cf. kothar#25
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Nov 21, 2015
1 parent 3c79fe2 commit 529f981
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions enc/encode.go
Expand Up @@ -283,6 +283,21 @@ func (w *BrotliWriter) Write(buffer []byte) (int, error) {
return copied, nil
}

func (w *BrotliWriter) Flush() error {
compressedData, err := w.compressor.writeBrotliData(false, true)
if err != nil {
return err
}
w.inRingBuffer = 0

_, err = w.writer.Write(compressedData)
if err != nil {
return err
}

return nil
}

func (w *BrotliWriter) Close() error {
compressedData, err := w.compressor.writeBrotliData(true, false)
if err != nil {
Expand Down

0 comments on commit 529f981

Please sign in to comment.