create volatile string pool loader

This commit is contained in:
REAndroid 2023-01-07 09:14:56 -05:00
parent 459307ac26
commit 8c7b70fd3a

View File

@ -256,6 +256,24 @@ public class ApkModule {
} }
return mTableBlock; return mTableBlock;
} }
// If we need TableStringPool only, this loads pool without
// loading packages and other chunk blocks for faster and less memory usage
public TableStringPool getVolatileTableStringPool() throws IOException{
if(mTableBlock!=null){
return mTableBlock.getTableStringPool();
}
InputSource inputSource = getApkArchive()
.getInputSource(TableBlock.FILE_NAME);
if(inputSource==null){
throw new IOException("Module don't have: "+TableBlock.FILE_NAME);
}
if((inputSource instanceof ZipEntrySource)
||(inputSource instanceof FileInputSource)){
return TableStringPool.readFromTable(inputSource.openStream());
}
return getTableBlock().getTableStringPool();
}
TableBlock loadTableBlock() throws IOException { TableBlock loadTableBlock() throws IOException {
APKArchive archive=getApkArchive(); APKArchive archive=getApkArchive();
InputSource inputSource = archive.getInputSource(TableBlock.FILE_NAME); InputSource inputSource = archive.getInputSource(TableBlock.FILE_NAME);