XU XUv0.8.8
EN

API

#archive/zip

import: #archive/zip

counts: 3 函数, 7 方法, 3 类型, 2 常量, 0 方法集

zip Reader/Writer(Store 与 deflate)。无 ZIP64。

const store

XuAPI
pub const store = 0

用途

公开常量 `store`。 值为 `0`

参数

无

const deflate

XuAPI
pub const deflate = 8

用途

公开常量 `deflate`。 值为 `8`

参数

无

struct File

XuAPI
pub struct File {
    pub name string
    pub method int
    pub crc32 int
    pub compressed_size int
    pub uncompressed_size int
    pub body string
}

用途

公开结构体 `File`。

参数

name string
名字
method int
字段(int)
crc32 int
字段(int)
compressed_size int
字段(int)
uncompressed_size int
字段(int)
body string
正文

struct Reader

XuAPI
pub struct Reader {
    pub data string
    pub pos int
}

用途

公开结构体 `Reader`。

参数

data string
数据
pos int
字段(int)

struct Writer

XuAPI
pub 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
}

用途

公开结构体 `Writer`。

参数

buf string
缓冲
names []string
字段([]string)
methods []int
字段([]int)
crcs []int
字段([]int)
comps []int
字段([]int)
uncomps []int
字段([]int)
offsets []int
字段([]int)
closed int
字段(int)
comment string
字段(string)

new_reader

XuAPI
pub fn new_reader(data &string) Reader

用途

构造 reader。

参数

data &string
数据(借用,调用方仍持有;类型 &string)

返回

Reader — 该类型的值

new_writer

XuAPI
pub fn new_writer() Writer

用途

构造 writer。

参数

无

返回

Writer — 该类型的值

(&mut Writer) set_comment

XuAPI
pub fn (w &mut Writer) set_comment(s string)

用途

`&mut Writer` 上的方法:设置 comment。

参数

w &mut Writer
接收者 &mut Writer(可变借用)
s string
源字符串(string)

(&Writer) file_count

XuAPI
pub fn (w &Writer) file_count() int

用途

`&Writer` 上的方法:文件计数。

参数

w &Writer
接收者 &Writer(借用)

返回

int — 该类型的值

comment

XuAPI
pub fn comment(data &string) string

用途

comment,返回 string。失败时 throw。

参数

data &string
数据(借用,调用方仍持有;类型 &string)

返回

string — 结果字符串

(&Writer) bytes

XuAPI
pub fn (w &Writer) bytes() string

用途

`&Writer` 上的方法:返回已缓冲的字节串。

参数

w &Writer
接收者 &Writer(借用)

返回

string — 结果字符串

(&mut Writer) write_file

XuAPI
pub fn (w &mut Writer) write_file(name &string, body &string) int

用途

`&mut Writer` 上的方法:写入文件。

参数

w &mut Writer
接收者 &mut Writer(可变借用)
name &string
名字(借用,调用方仍持有;类型 &string)
body &string
正文(借用,调用方仍持有;类型 &string)

返回

int — 该类型的值

(&mut Writer) write_file_deflate

XuAPI
pub fn (w &mut Writer) write_file_deflate(name &string, body &string) int

用途

`&mut Writer` 上的方法:写入文件deflate。

参数

w &mut Writer
接收者 &mut Writer(可变借用)
name &string
名字(借用,调用方仍持有;类型 &string)
body &string
正文(借用,调用方仍持有;类型 &string)

返回

int — 该类型的值

(&mut Writer) close

XuAPI
pub fn (w &mut Writer) close() int

用途

`&mut Writer` 上的方法:关闭资源。失败时 throw。

参数

w &mut Writer
接收者 &mut Writer(可变借用)

返回

int — 该类型的值

(&mut Reader) next

XuAPI
pub fn (r &mut Reader) next() File

用途

`&mut Reader` 上的方法:取出下一项;没有则按本类型约定结束。失败时 throw。

参数

r &mut Reader
接收者 &mut Reader(可变借用)

返回

File — 该类型的值