Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compress ¶
type Compress interface {
// Compress 将原始数据压缩为字节切片
// 如果压缩过程中发生错误,返回 error
Compress(data []byte) ([]byte, error)
// Decompress 将压缩后的数据解压为原始字节切片
// 如果解压过程中发生错误(如数据损坏),返回 error
Decompress(data []byte) ([]byte, error)
}
Compress 定义数据压缩与解压的通用接口 实现该接口的类型应当提供线程安全的压缩和解压方法
type GZIP ¶
type GZIP struct{}
GZIP 实现 Compress 接口,提供基于 gzip 的压缩与解压能力。 注意:该实现会将输入与输出完整加载到内存中,不适合超大数据。
Click to show internal directories.
Click to hide internal directories.