53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Decompress the data from the given io.Reader and write it to the given io.Writer
// I/O is buffered for better performance
func decompress(output io.Writer, input io.Reader) int {
var (
err error
buffer *bufio.Writer = bufio.NewWriter(output)
decompressor io.Reader = predictor.Decompressor(input)
)
_, err = io.Copy(buffer, bufio.NewReader(decompressor))
if err != nil {
fmt.Fprintln(os.Stderr, "Error while decompressing.\n", err)
return 1
}
// Flush
err = buffer.Flush()
|
|
|
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Decompress the data from the given io.Reader and write it to the given io.Writer
// I/O is buffered for better performance
func decompress(output io.Writer, input io.Reader) int {
var (
err error
buffer *bufio.Writer = bufio.NewWriter(output)
decompressor io.Reader = predictor.Decompressor(bufio.NewReader(input))
)
_, err = io.Copy(buffer, decompressor)
if err != nil {
fmt.Fprintln(os.Stderr, "Error while decompressing.\n", err)
return 1
}
// Flush
err = buffer.Flush()
|