Struct ZipLocalFileHeader

Source
pub struct ZipLocalFileHeader<'a> {
Show 16 fields pub version_required_to_extract: u16, pub general_purpose_flags: u16, pub compression_method: u16, pub last_mod_time: u16, pub last_mod_date: u16, pub crc32: u32, pub compressed_size: u32, pub uncompressed_size: u32, pub file_name_length: u16, pub extra_field_length: u16, pub file_name_raw: Vec<u8>, pub extra_field: Vec<u8>, pub compressed_data: Cow<'a, [u8]>, pub data_descriptor: Option<ZipDataDescriptor>, pub starting_position_with_signature: u64, pub starting_position_without_signature: u64,
}
Expand description

An entry of local header of ZIP file

Fields§

§version_required_to_extract: u16

As the name implies; see 4.4.3 in https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

Unaffected by file renaming

§general_purpose_flags: u16

See 4.4.4 in https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

bit #n reprents 1 << n in little endian

Unaffected by file renaming

§compression_method: u16

As the name implies; see 4.4.5 in https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

Unaffected by file renaming

§last_mod_time: u16

As the name implies; see 4.4.6 in https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

MS-DOS time: http://www.ffortune.net/calen/calen/etime.htm (Japanese)

Unaffected by file renaming

§last_mod_date: u16

As the name implies; see 4.4.6 in https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

MS-DOS time: http://www.ffortune.net/calen/calen/etime.htm (Japanese)

Unaffected by file renaming

§crc32: u32

See 4.4.7 in https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

Unaffected by file renaming

§compressed_size: u32

As the name implies. Note that the file name is not included.

§uncompressed_size: u32

As the name implies. Note that the file name is not included.

§file_name_length: u16

As the name implies.

§extra_field_length: u16

As the name implies.

§file_name_raw: Vec<u8>

Byte sequence of the file name.

§extra_field: Vec<u8>

Byte sequence of extra field

§compressed_data: Cow<'a, [u8]>

File content

§data_descriptor: Option<ZipDataDescriptor>

Data descriptor just after the file content (exists only when bit #3 of general purpose flag is set)

§starting_position_with_signature: u64

ローカルファイルヘッダの開始位置 (マジックナンバー) / (magick number of) local file header starting position

§starting_position_without_signature: u64

ローカルファイルヘッダの開始位置 (マジックナンバーすぐ次) / Local file header starting position (next to magick number)

Implementations§

Source§

impl ZipLocalFileHeader<'_>

Source

pub fn set_utf8_encoded_flag(&mut self)

Sets bit #11 of general purpose bit to indicate that the file name & comment are encoded in UTF-8.

Source

pub fn set_file_name_from_slice(&mut self, name: &Vec<u8>)

Replaces the file name.

§Arguments
  • name - Slice of new name
Source

pub fn read_and_generate_from_signature<T: ReadBytesExt + Seek>( read: &mut T, ) -> Result<Self, ZipReadError>

Reads local file header from the cjurrent position.

§Arguments
  • read - file handler (must be at the start of the signature)
Source

pub fn from_central_directory<T: ReadBytesExt + Seek>( read: &mut T, cd: &ZipCDEntry, ) -> Result<Self, ZipReadError>

Examines the signature, reads the local file header and returns an instance that represents it

§Arguments
  • read - file handler (must be at the head of the signature)
Source

pub fn write<T: WriteBytesExt>(&self, write: &mut T) -> Result<u64>

Writes the content of this local file header to file and returns the number of bytes written.

§Arguments
  • write - file handler

Auto Trait Implementations§

§

impl<'a> Freeze for ZipLocalFileHeader<'a>

§

impl<'a> RefUnwindSafe for ZipLocalFileHeader<'a>

§

impl<'a> Send for ZipLocalFileHeader<'a>

§

impl<'a> Sync for ZipLocalFileHeader<'a>

§

impl<'a> Unpin for ZipLocalFileHeader<'a>

§

impl<'a> UnwindSafe for ZipLocalFileHeader<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.