pub struct Apk<R: Read + Seek = File> { /* private fields */ }Expand description
An APK opened for reading.
Opening checks UTF-8 names, duplicate entries, ZIP headers, and entry
placement (see ZipError for the rejected layouts).
use apk::Apk;
let mut apk = Apk::open("app.apk")?;
let manifest = apk.manifest()?;
println!("{} (API {}+)", manifest.package().unwrap_or_default(), manifest.min_sdk());
println!("{manifest}");Implementations§
Source§impl<'a> Apk<Cursor<&'a [u8]>>
impl<'a> Apk<Cursor<&'a [u8]>>
pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, Error>
Source§impl<R: Read + Seek> Apk<R>
impl<R: Read + Seek> Apk<R>
pub fn new(reader: R) -> Result<Self, Error>
Sourcepub fn entries(&self) -> impl Iterator<Item = &str>
pub fn entries(&self) -> impl Iterator<Item = &str>
The entry names, in central directory order.
Sourcepub fn read(&mut self, name: &str) -> Result<Vec<u8>, Error>
pub fn read(&mut self, name: &str) -> Result<Vec<u8>, Error>
Reads and decompresses the entry name.
Sourcepub fn read_limited(&mut self, name: &str, limit: u64) -> Result<Vec<u8>, Error>
pub fn read_limited(&mut self, name: &str, limit: u64) -> Result<Vec<u8>, Error>
Reads the entry name, failing if it decompresses to more than limit
bytes. Declared sizes are not trusted.
Sourcepub fn label(&mut self) -> Result<Option<String>, Error>
pub fn label(&mut self) -> Result<Option<String>, Error>
The application label in the default configuration, following string resource references.
Sourcepub fn native_libraries(&self) -> BTreeMap<Abi, Vec<LibraryName>>
pub fn native_libraries(&self) -> BTreeMap<Abi, Vec<LibraryName>>
The native libraries (lib/<abi>/lib<name>.so), by ABI.
Auto Trait Implementations§
impl<R> Freeze for Apk<R>where
ZipArchive<R>: Freeze,
impl<R> RefUnwindSafe for Apk<R>where
ZipArchive<R>: RefUnwindSafe,
impl<R> Send for Apk<R>where
ZipArchive<R>: Send,
impl<R> Sync for Apk<R>where
ZipArchive<R>: Sync,
impl<R> Unpin for Apk<R>where
ZipArchive<R>: Unpin,
impl<R> UnsafeUnpin for Apk<R>where
ZipArchive<R>: UnsafeUnpin,
impl<R> UnwindSafe for Apk<R>where
ZipArchive<R>: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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