const STORE
XuAPI
pub const STORE = 0用途
常量 STORE,定义了相关的协议或算法配置参数。
#archive/zipzip Reader/Writer(Store 与 deflate)。无 ZIP64。
const STOREpub const STORE = 0常量 STORE,定义了相关的协议或算法配置参数。
const DEFLATEpub const DEFLATE = 8常量 DEFLATE,定义了相关的协议或算法配置参数。
struct Filepub struct File {
pub name string
pub method int
pub crc32 int
pub compressed_size int
pub uncompressed_size int
pub body string
}承载 name、method、crc32、compressed_size、uncompressed_size 等属性的结构体。
name stringmethod intcrc32 intcompressed_size intuncompressed_size intbody stringstruct Readerpub struct Reader {
pub data string
pub pos int
}Zip 流式数据读取与解码器。
data stringpos intstruct Writerpub struct Writer {
pub buf string
pub names []string
pub methods []int
pub crcs []int
pub comps []int
pub uncomps []int
pub offsets []int
pub closed int
pub comment string
}Zip 流式数据写入与序列化器。
buf stringnames []stringmethods []intcrcs []intcomps []intuncomps []intoffsets []intclosed intcomment stringnew_readerpub fn new_reader(data &string) Reader构造 reader。
data &stringReader — 该类型的值
new_writerpub fn new_writer() Writer构造 writer。
无需传入参数。
Writer — 该类型的值
($&Writer) set_commentpub fn (w $&Writer) set_comment(s string)$&Writer 上的操作:设置 comment。
w $&WriterWriter 实例;以独占借用传入,方法可修改它,调用方仍持有实例。s string不返回值。
(&Writer) file_countpub fn (w &Writer) file_count() int&Writer 上的操作:文件计数。
w &WriterWriter 实例;以只读借用传入,调用方仍持有实例。int — 该类型的值
commentpub fn comment(data &string) string执行 comment 处理。失败时抛出错误,调用方需处理或继续传播。
data &stringstring — 结果字符串
(&Writer) bytespub fn (w &Writer) bytes() string&Writer 上的操作:返回已缓冲的字节串。
w &WriterWriter 实例;以只读借用传入,调用方仍持有实例。string — 结果字符串
($&Writer) write_filepub fn (w $&Writer) write_file(name &string, body &string) int$&Writer 上的操作:写入文件。
w $&WriterWriter 实例;以独占借用传入,方法可修改它,调用方仍持有实例。name &stringbody &stringint — 该类型的值
($&Writer) write_file_deflatepub fn (w $&Writer) write_file_deflate(name &string, body &string) int$&Writer 上的操作:写入文件压缩。
w $&WriterWriter 实例;以独占借用传入,方法可修改它,调用方仍持有实例。name &stringbody &stringint — 该类型的值
($&Writer) closepub fn (w $&Writer) close() int$&Writer 上的操作:关闭资源。失败时抛出错误,调用方需处理或继续传播。
w $&WriterWriter 实例;以独占借用传入,方法可修改它,调用方仍持有实例。int — 该类型的值
($&Reader) nextpub fn (r $&Reader) next() File$&Reader 上的操作:取出下一项;没有则按本类型约定结束。失败时抛出错误,调用方需处理或继续传播。
r $&ReaderReader 实例;以独占借用传入,方法可修改它,调用方仍持有实例。File — 该类型的值