pub struct SevenZWriter<W: Write> { /* private fields */ }Expand description
Writes a 7z file.
Implementations§
Source§impl<W: Write + Seek> SevenZWriter<W>
impl<W: Write + Seek> SevenZWriter<W>
Source§impl SevenZWriter<File>
impl SevenZWriter<File>
Source§impl<W: Write + Seek> SevenZWriter<W>
impl<W: Write + Seek> SevenZWriter<W>
Sourcepub fn set_content_methods(
&mut self,
content_methods: Vec<SevenZMethodConfiguration>,
) -> &mut Self
pub fn set_content_methods( &mut self, content_methods: Vec<SevenZMethodConfiguration>, ) -> &mut Self
Sets the default compression methods to use for entry data. Default is LZMA2.
Sourcepub fn set_encrypt_header(&mut self, enabled: bool)
pub fn set_encrypt_header(&mut self, enabled: bool)
Whether to enable the encryption of the -header. Default is true.
Sourcepub fn push_archive_entry<R: Read>(
&mut self,
entry: SevenZArchiveEntry,
reader: Option<R>,
) -> Result<&SevenZArchiveEntry, Error>
pub fn push_archive_entry<R: Read>( &mut self, entry: SevenZArchiveEntry, reader: Option<R>, ) -> Result<&SevenZArchiveEntry, Error>
Adds an archive entry with data from reader.
§Example
use sevenz_rust2::*;
use std::fs::File;
use std::path::Path;
let mut sz = SevenZWriter::create("path/to/dest.7z").expect("create writer ok");
let src = Path::new("path/to/source.txt");
let name = "source.txt".to_string();
let entry = sz.push_archive_entry(
SevenZArchiveEntry::from_path(&src, name),
Some(File::open(src).unwrap()),
)
.expect("ok");
let compressed_size = entry.compressed_size;
sz.finish().expect("done");Sourcepub fn push_archive_entries<R: Read>(
&mut self,
entries: Vec<SevenZArchiveEntry>,
reader: SeqReader<SourceReader<R>>,
) -> Result<&mut Self, Error>
pub fn push_archive_entries<R: Read>( &mut self, entries: Vec<SevenZArchiveEntry>, reader: SeqReader<SourceReader<R>>, ) -> Result<&mut Self, Error>
Solid compression - packs entries into one pack.
§Panics
- If
entries’s length not equals toreader.reader_len()
Auto Trait Implementations§
impl<W> Freeze for SevenZWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for SevenZWriter<W>where
W: RefUnwindSafe,
impl<W> Send for SevenZWriter<W>where
W: Send,
impl<W> Sync for SevenZWriter<W>where
W: Sync,
impl<W> Unpin for SevenZWriter<W>where
W: Unpin,
impl<W> UnwindSafe for SevenZWriter<W>where
W: UnwindSafe,
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