XU XUv0.16.0

#archive/zip

import: #archive/zip

counts: 3 functions, 7 methods, 3 types, 2 constants, 0 method sets

zip Reader/Writer (Store and deflate). No ZIP64.

const STORE

XuAPI
pub const STORE = 0

Purpose

Constant STORE, defining protocol or algorithm parameters.

const DEFLATE

XuAPI
pub const DEFLATE = 8

Purpose

Constant DEFLATE, defining protocol or algorithm parameters.

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
}

Purpose

Structure encapsulating name, method, crc32, compressed_size, uncompressed_size.

Public fields

name string
name
method int
field (int)
crc32 int
field (int)
compressed_size int
field (int)
uncompressed_size int
field (int)
body string
body

struct Reader

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

Purpose

Zip Streaming reader and decoder.

Public fields

data string
data
pos int
field (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
}

Purpose

Zip Streaming writer and encoder.

Public fields

buf string
buffer
names []string
field ([]string)
methods []int
field ([]int)
crcs []int
field ([]int)
comps []int
field ([]int)
uncomps []int
field ([]int)
offsets []int
field ([]int)
closed int
field (int)
comment string
field (string)

new_reader

XuAPI
pub fn new_reader(data &string) Reader

Purpose

Construct reader.

Parameters

data &string
data (read-only borrow; caller keeps the original; type &string)

Returns

Reader — a value of this type

new_writer

XuAPI
pub fn new_writer() Writer

Purpose

Construct writer.

Parameters

No arguments are required.

Returns

Writer — a value of this type

($&Writer) set_comment

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

Purpose

Operation on $&Writer: set comment.

Parameters

w $&Writer
The Writer instance used by this call (exclusive borrow).
s string
source string (string)

Returns

This call does not return a value.

(&Writer) file_count

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

Purpose

Operation on &Writer: file count.

Parameters

w &Writer
The Writer instance used by this call (borrow).

Returns

int — a value of this type

comment

XuAPI
pub fn comment(data &string) string

Purpose

Execute comment. Throws on failure; handle the error or propagate it to the caller.

Parameters

data &string
data (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

(&Writer) bytes

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

Purpose

Operation on &Writer: return the buffered bytes.

Parameters

w &Writer
The Writer instance used by this call (borrow).

Returns

string — result string

($&Writer) write_file

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

Purpose

Operation on $&Writer: write file.

Parameters

w $&Writer
The Writer instance used by this call (exclusive borrow).
name &string
name (read-only borrow; caller keeps the original; type &string)
body &string
body (read-only borrow; caller keeps the original; type &string)

Returns

int — a value of this type

($&Writer) write_file_deflate

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

Purpose

Operation on $&Writer: write file deflate.

Parameters

w $&Writer
The Writer instance used by this call (exclusive borrow).
name &string
name (read-only borrow; caller keeps the original; type &string)
body &string
body (read-only borrow; caller keeps the original; type &string)

Returns

int — a value of this type

($&Writer) close

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

Purpose

Operation on $&Writer: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

w $&Writer
The Writer instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Reader) next

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

Purpose

Operation on $&Reader: take the next item, or end according to this type. Throws on failure; handle the error or propagate it to the caller.

Parameters

r $&Reader
The Reader instance used by this call (exclusive borrow).

Returns

File — a value of this type