struct Reader
pub struct Reader {
pub data string
pub sticky string
}用途
公开结构体 `Reader`。
参数
datastring- 数据
stickystring- 字段(string)
API
#compress/gzipgzip Reader/Writer,校验 CRC-32。
struct Readerpub struct Reader {
pub data string
pub sticky string
}公开结构体 `Reader`。
data stringsticky stringstruct Headerpub struct Header {
pub mtime int
pub name string
pub comment string
pub os int
}公开结构体 `Header`。
mtime intname stringcomment stringos intstruct Writerpub struct Writer {
pub buf string
pub out string
pub closed bool
pub name string
pub comment string
pub mtime int
pub os int
}公开结构体 `Writer`。
buf stringout stringclosed boolname stringcomment stringmtime intos intconst os_fatpub const os_fat = 0公开常量 `os_fat`。 值为 `0`
无
const os_unixpub const os_unix = 3公开常量 `os_unix`。 值为 `3`
无
const os_macintoshpub const os_macintosh = 7公开常量 `os_macintosh`。 值为 `7`
无
const os_ntfspub const os_ntfs = 11公开常量 `os_ntfs`。 值为 `11`
无
const os_unknownpub const os_unknown = 255公开常量 `os_unknown`。 值为 `255`
无
host_ospub fn host_os() int主机os。
无
int — 该类型的值
new_readerpub fn new_reader(data string) Reader构造 reader。
data stringReader — 该类型的值
new_writerpub fn new_writer() Writer构造 writer。
无
Writer — 该类型的值
(&mut Writer) set_namepub fn (w &mut Writer) set_name(n string)`&mut Writer` 上的方法:设置 name。
w &mut Writern string(&mut Writer) set_commentpub fn (w &mut Writer) set_comment(s string)`&mut Writer` 上的方法:设置 comment。
w &mut Writers string(&mut Writer) set_mtimepub fn (w &mut Writer) set_mtime(sec int)`&mut Writer` 上的方法:设置 mtime。
w &mut Writersec int(&mut Writer) set_ospub fn (w &mut Writer) set_os(id int)`&mut Writer` 上的方法:设置 os。
w &mut Writerid int(&Reader) headerpub fn (r &Reader) header() Header`&Reader` 上的方法:头。失败时 throw。
r &ReaderHeader — 该类型的值
(&mut Reader) read_allpub fn (r &mut Reader) read_all() string`&mut Reader` 上的方法:读取all。失败时 throw。
r &mut Readerstring — 结果字符串
(&mut Writer) writepub fn (w &mut Writer) write(data &string) int`&mut Writer` 上的方法:写入数据,返回写入的字节数。失败时 throw。
w &mut Writerdata &stringint — 写入的字节数
(&mut Writer) write_stringpub fn (w &mut Writer) write_string(s string) int`&mut Writer` 上的方法:写入字符串,返回写入的字节数。
w &mut Writers stringint — 写入的字节数
(&mut Writer) closepub fn (w &mut Writer) close() int`&mut Writer` 上的方法:关闭资源。
w &mut Writerint — 该类型的值
(&Writer) bytespub fn (w &Writer) bytes() string`&Writer` 上的方法:返回已缓冲的字节串。
w &Writerstring — 结果字符串
(&Writer) textpub fn (w &Writer) text() string`&Writer` 上的方法:返回当前文本。
w &Writerstring — 结果字符串
copy_streampub fn copy_stream#W:StreamWriter,R:StreamReader(dst &mut W, src &mut R) int拷贝流。失败时 throw。
dst &mut Wsrc &mut Rint — 该类型的值