pub struct DexReader {
pub bytes: Cursor<Vec<u8>>,
pub bytes_len: u64,
pub endianness: DexEndianness,
}Expand description
A reader for a DEX file
Fields§
§bytes: Cursor<Vec<u8>>A cursor over the bytes of the DEX file
bytes_len: u64Number of bytes in the DEX file
endianness: DexEndiannessEndianness of the DEX file
Implementations§
Source§impl DexReader
impl DexReader
Sourcepub fn build_from_file(filepath: &str) -> Result<Vec<DexReader>, DexError>
pub fn build_from_file(filepath: &str) -> Result<Vec<DexReader>, DexError>
Open the file at the given path and create reader(s)
Each APK can contain multiple DEX files. This function extracts them all, create a reader from each, and returns a vector of readers.
Sourcepub fn build(raw_dex: Vec<u8>) -> Result<Self, DexError>
pub fn build(raw_dex: Vec<u8>) -> Result<Self, DexError>
Read a DEX file and create a reader from it
Sourcepub fn check_endianness(bytes: &[u8]) -> Result<DexEndianness, DexError>
pub fn check_endianness(bytes: &[u8]) -> Result<DexEndianness, DexError>
Check the endianness of a DEX file
Sourcepub fn align_cursor(&mut self) -> Result<(), DexError>
pub fn align_cursor(&mut self) -> Result<(), DexError>
Check if the cursor is on an even-numbered bytecode offsets and, if not, consume data until it is
Sourcepub fn read_u8(&mut self) -> Result<u8, DexError>
pub fn read_u8(&mut self) -> Result<u8, DexError>
Read an unsigned 8 bits integer from the reader
Sourcepub fn read_u16(&mut self) -> Result<u16, DexError>
pub fn read_u16(&mut self) -> Result<u16, DexError>
Read an unsigned 16 bits integer from the reader
Sourcepub fn read_u32(&mut self) -> Result<u32, DexError>
pub fn read_u32(&mut self) -> Result<u32, DexError>
Read an unsigned 32 bits integer from the reader
Sourcepub fn read_i32(&mut self) -> Result<i32, DexError>
pub fn read_i32(&mut self) -> Result<i32, DexError>
Read a signed 32 bits integer from the reader
Sourcepub fn read_uleb128(&mut self) -> Result<(u32, usize), DexError>
pub fn read_uleb128(&mut self) -> Result<(u32, usize), DexError>
Read an unsigned LEB128 value from the reader
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DexReader
impl RefUnwindSafe for DexReader
impl Send for DexReader
impl Sync for DexReader
impl Unpin for DexReader
impl UnwindSafe for DexReader
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