pub struct EwfReader { /* private fields */ }Expand description
A reader for Expert Witness Format (E01/EWF) forensic disk images.
Implements Read and Seek over the logical disk image stored across
one or more .E01/.E02/… segment files.
§Example
use std::io::Read;
let mut reader = ewf::EwfReader::open("disk.E01").unwrap();
let mut buf = [0u8; 512];
reader.read_exact(&mut buf).unwrap(); // read first sectorImplementations§
Source§impl EwfReader
impl EwfReader
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open an EWF image from a path to the first segment file (e.g. image.E01).
Automatically discovers and opens all additional segment files.
Sourcepub fn open_with_cache_size<P: AsRef<Path>>(
path: P,
cache_size: usize,
) -> Result<Self>
pub fn open_with_cache_size<P: AsRef<Path>>( path: P, cache_size: usize, ) -> Result<Self>
Open an EWF image with a custom LRU cache size.
cache_size is the number of decompressed chunks to keep in memory.
Each chunk is typically 32 KB, so 100 chunks ≈ 3.2 MB, 1000 ≈ 32 MB.
Sourcepub fn open_segments(paths: &[PathBuf]) -> Result<Self>
pub fn open_segments(paths: &[PathBuf]) -> Result<Self>
Open an EWF image from explicit segment file paths (must be in order).
Sourcepub fn open_segments_with_cache_size(
paths: &[PathBuf],
cache_size: usize,
) -> Result<Self>
pub fn open_segments_with_cache_size( paths: &[PathBuf], cache_size: usize, ) -> Result<Self>
Open from explicit segment paths with a custom LRU cache size.
Sourcepub fn total_size(&self) -> u64
pub fn total_size(&self) -> u64
Total logical size of the disk image in bytes.
Sourcepub fn chunk_size(&self) -> u64
pub fn chunk_size(&self) -> u64
Chunk size in bytes (typically 32768).
Sourcepub fn chunk_count(&self) -> usize
pub fn chunk_count(&self) -> usize
Number of chunks in the image.
Trait Implementations§
Source§impl Read for EwfReader
impl Read for EwfReader
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read. Read more
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
Reads all bytes until EOF in this source, placing them into
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Reads all bytes until EOF in this source, appending them to
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Reads the exact number of bytes required to fill
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf)Pull some bytes from this source into the specified buffer. Read more
Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf)Reads the exact number of bytes required to fill
cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adapter for this instance of
Read. Read more1.0.0 · Source§fn chain<R>(self, next: R) -> Chain<Self, R>
fn chain<R>(self, next: R) -> Chain<Self, R>
Creates an adapter which will chain this stream with another. Read more
Source§impl Seek for EwfReader
impl Seek for EwfReader
Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream. Read more
1.55.0 · Source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Rewind to the beginning of a stream. Read more
Source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
🔬This is a nightly-only experimental API. (
seek_stream_len)Returns the length of this stream (in bytes). Read more
Auto Trait Implementations§
impl Freeze for EwfReader
impl RefUnwindSafe for EwfReader
impl Send for EwfReader
impl Sync for EwfReader
impl Unpin for EwfReader
impl UnsafeUnpin for EwfReader
impl UnwindSafe for EwfReader
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