pub struct FileBlockEncryptReadStream { /* private fields */ }Expand description
A stream to read an encrypted large file using blocks for fast skip
Implementations§
Source§impl FileBlockEncryptReadStream
impl FileBlockEncryptReadStream
Sourcepub fn new<P>(
file_path: P,
key: Vec<u8>,
) -> Result<FileBlockEncryptReadStream, BlockFileOpenError>
pub fn new<P>( file_path: P, key: Vec<u8>, ) -> Result<FileBlockEncryptReadStream, BlockFileOpenError>
Creates a new instance of FileBlockEncryptReadStream Opens the file and reads the header
Parameters:
file_path- Path to the file to openkey- The encryption key
Returns an instance of FileBlockEncryptReadStream, or an error
Sourcepub fn get_file_size(&self) -> u64
pub fn get_file_size(&self) -> u64
Gets the size of the file
Sourcepub fn get_block_size(&self) -> u64
pub fn get_block_size(&self) -> u64
Gets the size of the blocks in the file
Sourcepub fn get_block_count(&self) -> u64
pub fn get_block_count(&self) -> u64
Gets the total number of blocks in the file
Sourcepub fn get_cursor(&self) -> u64
pub fn get_cursor(&self) -> u64
Gets the current cursor position
Sourcepub fn seek(&mut self, pos: SeekFrom) -> Result<u64, BlockFileReadError>
pub fn seek(&mut self, pos: SeekFrom) -> Result<u64, BlockFileReadError>
Seeks the file, changing the position of the cursor
Parameters:
pos- The position in the file to seek to
Returns the new position of the cursor, or an error
Sourcepub fn read(&mut self, buf: &mut [u8]) -> Result<usize, BlockFileReadError>
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize, BlockFileReadError>
Reads data into a buffer
Parameters:
buf- The buffer for the data to be placed into
Returns the number of bytes read, or an error When the files does not contain more bytes, the error will be BlockFileReadError::EndOfFile
Auto Trait Implementations§
impl Freeze for FileBlockEncryptReadStream
impl RefUnwindSafe for FileBlockEncryptReadStream
impl Send for FileBlockEncryptReadStream
impl Sync for FileBlockEncryptReadStream
impl Unpin for FileBlockEncryptReadStream
impl UnwindSafe for FileBlockEncryptReadStream
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