Struct sevenz_rust::Archive
source · pub struct Archive {
pub pack_pos: u64,
pub pack_sizes: Vec<u64>,
pub pack_crcs_defined: BitSet,
pub pack_crcs: Vec<u64>,
pub folders: Vec<Folder>,
pub sub_streams_info: Option<SubStreamsInfo>,
pub files: Vec<SevenZArchiveEntry>,
pub stream_map: StreamMap,
}
Fields§
§pack_pos: u64
Offset from beginning of file + SIGNATURE_HEADER_SIZE to packed streams.
pack_sizes: Vec<u64>
§pack_crcs_defined: BitSet
§pack_crcs: Vec<u64>
§folders: Vec<Folder>
§sub_streams_info: Option<SubStreamsInfo>
§files: Vec<SevenZArchiveEntry>
§stream_map: StreamMap
Implementations§
source§impl Archive
impl Archive
sourcepub fn open(path: impl AsRef<Path>) -> Result<Archive, Error>
pub fn open(path: impl AsRef<Path>) -> Result<Archive, Error>
Open 7z file under specified path
.
sourcepub fn open_with_password(
path: impl AsRef<Path>,
password: &Password
) -> Result<Archive, Error>
pub fn open_with_password( path: impl AsRef<Path>, password: &Password ) -> Result<Archive, Error>
Open an encrypted 7z file under specified path
with password
.
sourcepub fn read<R: Read + Seek>(
reader: &mut R,
reader_len: u64,
password: &[u8]
) -> Result<Archive, Error>
pub fn read<R: Read + Seek>( reader: &mut R, reader_len: u64, password: &[u8] ) -> Result<Archive, Error>
Read 7z file archive info use the specified reader
.
-[reader_len
] the reader
stream length
-[password
] Archive password encoded in utf16 little endian.
Examples
use std::io::{Read,Seek};
use std::fs::File;
use sevenz_rust::*;
let mut reader = File::open("example.7z").unwrap();
let len = reader.metadata().unwrap().len();
let password = Password::from("the password");
let archive = Archive::read(&mut reader,len, password.as_ref()).unwrap();
//let archive = Archive::read(&mut reader,len, &[]);// for unencrypted file
for entry in &archive.files {
println!("{}", entry.name());
}
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Archive
impl Send for Archive
impl Sync for Archive
impl Unpin for Archive
impl UnwindSafe for Archive
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more