method to write header to a path

This commit is contained in:
Bruce Leidl 2019-01-29 13:42:17 -05:00
parent 322fa97f6a
commit d23e488aaa

View File

@ -1,5 +1,5 @@
use std::cell::RefCell; use std::cell::RefCell;
use std::fs::File; use std::fs::{File,OpenOptions};
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::path::Path; use std::path::Path;
@ -245,6 +245,10 @@ impl ImageHeader {
Ok(()) Ok(())
} }
pub fn write_header_to<P: AsRef<Path>>(&self, path: P) -> Result<()> {
self.write_header(OpenOptions::new().write(true).open(path.as_ref())?)
}
pub fn clear(&self) { pub fn clear(&self) {
for b in &mut self.0.borrow_mut()[..] { for b in &mut self.0.borrow_mut()[..] {
*b = 0; *b = 0;