From 61f361f77cc1009b33c5e9adb03ffc66cbca835a Mon Sep 17 00:00:00 2001 From: REAndroid Date: Tue, 23 Apr 2024 19:14:49 +0200 Subject: [PATCH] Closable ApkBundle --- src/main/java/com/reandroid/apk/ApkBundle.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/reandroid/apk/ApkBundle.java b/src/main/java/com/reandroid/apk/ApkBundle.java index 3ca4eb85a..735e38ba8 100644 --- a/src/main/java/com/reandroid/apk/ApkBundle.java +++ b/src/main/java/com/reandroid/apk/ApkBundle.java @@ -22,12 +22,13 @@ import com.reandroid.arsc.pool.TableStringPool; import com.reandroid.arsc.pool.builder.StringPoolMerger; +import java.io.Closeable; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.*; -public class ApkBundle { +public class ApkBundle implements Closeable { private final Map mModulesMap; private APKLogger apkLogger; public ApkBundle(){ @@ -196,6 +197,13 @@ private boolean hasOneTableBlock(){ } return false; } + @Override + public void close() throws IOException { + for(ApkModule module : mModulesMap.values()) { + module.close(); + } + mModulesMap.clear(); + } public void setAPKLogger(APKLogger logger) { this.apkLogger = logger; }