Struct blockwise_reader::BlockWiseReader
source · pub struct BlockWiseReader<'a> { /* private fields */ }Expand description
The BlockWiseReader holds the data which are read in to a specific point and a reader to read from
Implementations§
source§impl<'a> BlockWiseReader<'a>
impl<'a> BlockWiseReader<'a>
sourcepub fn available_bytes(&self) -> usize
pub fn available_bytes(&self) -> usize
bytes from the current pos position to the end of the internal vector
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
overall size of the internal vector, is the same as available_bytes() + pos_get()
sourcepub fn slurp(&mut self, bytecount: usize) -> Result<usize, Error>
pub fn slurp(&mut self, bytecount: usize) -> Result<usize, Error>
Reads bytecount bytes from the stream and returns the amount of available bytes starting at pos, which can be more than bytecount when subsequently already read more, but also less if there were not enough available.
sourcepub fn slurp_loop(&mut self, buffersize: usize) -> Result<usize, Error>
pub fn slurp_loop(&mut self, buffersize: usize) -> Result<usize, Error>
Reads bytes from the stream in buffersize steps as long as there are bytes available.
sourcepub fn search(&self, bytes: &[u8]) -> Option<usize>
pub fn search(&self, bytes: &[u8]) -> Option<usize>
searches a byte slice in the available bytes
sourcepub fn pos_add_i(&mut self, pos: isize)
pub fn pos_add_i(&mut self, pos: isize)
adds to the internal position a positive or negative value
sourcepub fn pos_cut(&mut self) -> Vec<u8>
pub fn pos_cut(&mut self) -> Vec<u8>
removes all elements form the beginning of the internal vector to pos and returns the removed elements
sourcepub fn pos_inject(&mut self, s: &[u8])
pub fn pos_inject(&mut self, s: &[u8])
copies the data of the slice s at the position pos
sourcepub fn get_back(&self, back: usize) -> &[u8] ⓘ
pub fn get_back(&self, back: usize) -> &[u8] ⓘ
returns all data from pos - back to pos of the internal vector
sourcepub fn get_from(&self, pos: usize) -> &[u8] ⓘ
pub fn get_from(&self, pos: usize) -> &[u8] ⓘ
returns all data from the given pos to the end of the internal vector
sourcepub fn get_from_to_current(&self, pos: usize) -> &[u8] ⓘ
pub fn get_from_to_current(&self, pos: usize) -> &[u8] ⓘ
returns all data from the given pos to the internal pos
sourcepub fn slurp_match_repos(&mut self, marker_str: &[u8]) -> Result<bool, Error>
pub fn slurp_match_repos(&mut self, marker_str: &[u8]) -> Result<bool, Error>
slurps as much as the marker_str is long and returns true if the content is the same as the marker_str, repositions the current position to the end of the marker
sourcepub fn match_back(&self, marker_str: &[u8]) -> bool
pub fn match_back(&self, marker_str: &[u8]) -> bool
matches a fixed string from pos - marker_str.len() to pos, returns true if matched
sourcepub fn slurp_find_repos1(
&mut self,
bytecount: usize,
e: u8
) -> Result<bool, Error>
pub fn slurp_find_repos1( &mut self, bytecount: usize, e: u8 ) -> Result<bool, Error>
Sets pos to find position + 1 if the byte was found in the available bytes. If nothing was found pos remains unaltered.
sourcepub fn slurp_find_repos0(
&mut self,
bytecount: usize,
e: u8
) -> Result<bool, Error>
pub fn slurp_find_repos0( &mut self, bytecount: usize, e: u8 ) -> Result<bool, Error>
Sets pos to find position if the byte was found in the available bytes. If nothing was found pos remains unaltered.
sourcepub fn slurp_find_repos(
&mut self,
bytecount: usize,
e: u8,
fp: FindPos
) -> Result<bool, Error>
pub fn slurp_find_repos( &mut self, bytecount: usize, e: u8, fp: FindPos ) -> Result<bool, Error>
Sets pos regarding the fp flag if the byte was found in the available bytes. If nothing was found pos remains unaltered.
sourcepub fn slurp_find_multiple_repos(
&mut self,
bytecount: usize,
se: &[u8],
cut: bool,
fp: FindPos
) -> Result<bool, Error>
pub fn slurp_find_multiple_repos( &mut self, bytecount: usize, se: &[u8], cut: bool, fp: FindPos ) -> Result<bool, Error>
Sets pos regarding the fp flag if one pf the the bytes was found in the available bytes. If nothing was found pos remains unaltered. Finds the nearest byte if cut is false. The parameter cut stops searching if a byte was found.
sourcepub fn slurp_find_multiple_repos_idx(
&mut self,
bytecount: usize,
se: &[u8],
cut: bool,
fp: FindPos
) -> Result<Option<PatternIdx>, Error>
pub fn slurp_find_multiple_repos_idx( &mut self, bytecount: usize, se: &[u8], cut: bool, fp: FindPos ) -> Result<Option<PatternIdx>, Error>
Sets pos regarding the fp flag if one pf the the bytes was found in the available bytes. If nothing was found pos remains unaltered. Finds the nearest byte if cut is false. The parameter cut stops searching if a byte was found. Returns the idx of the matched pattern.
sourcepub fn slurp_search_repos0(
&mut self,
bytecount: usize,
bytes: &[u8]
) -> Result<bool, Error>
pub fn slurp_search_repos0( &mut self, bytecount: usize, bytes: &[u8] ) -> Result<bool, Error>
Sets pos to find position if the byte slice was found in the available bytes. If nothing was found pos remains unaltered.
sourcepub fn slurp_search_repos1(
&mut self,
bytecount: usize,
bytes: &[u8]
) -> Result<bool, Error>
pub fn slurp_search_repos1( &mut self, bytecount: usize, bytes: &[u8] ) -> Result<bool, Error>
Sets pos after find position if the byte slice was found in the available bytes. If nothing was found pos remains unaltered.
sourcepub fn slurp_search_repos(
&mut self,
bytecount: usize,
bytes: &[u8],
fp: FindPos
) -> Result<bool, Error>
pub fn slurp_search_repos( &mut self, bytecount: usize, bytes: &[u8], fp: FindPos ) -> Result<bool, Error>
Sets pos regarding the fp flag find position if the byte slice was found in the available bytes. If nothing was found pos remains unaltered.