Refactor VM.openAsset
@@ -13,10 +13,8 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryUsage;
@@ -225,7 +223,7 @@ public abstract class BaseVM implements VM {
}
@Override
- public InputStream openAsset(String fileName) {
+ public byte[] openAsset(String fileName) {
if (apkFile == null) {
return null;
}
@@ -233,8 +231,7 @@ public abstract class BaseVM implements VM {
ApkFile apkFile = null;
try {
apkFile = new ApkFile(this.apkFile);
- byte[] data = apkFile.getFileData("assets/" + fileName);
- return data == null ? null : new ByteArrayInputStream(data);
+ return apkFile.getFileData("assets/" + fileName);
} catch (IOException e) {
throw new IllegalStateException(e);
} finally {
