var buf bytes.Buffer
compressor, err := zlib.NewWriterLevelDict(&buf, zlib.BestCompression, input)
if err != nil {
fmt.Println("压缩失败")
return
}
compressor.Write(input)
compressor.Close()
fmt.Println(buf.Bytes())
fmt.Println(len(buf.Bytes()))
fmt.Println(len(input))
}
希望本文所述对大家的Go语言程序设计有所帮助。










