Ohh, Java does scoped resources.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4413 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-08-22 02:45:22 +00:00
parent f1b55ddd64
commit 59b2ffaf95

View File

@ -63,14 +63,16 @@ public class MainActivity extends Activity {
while ((entry = zip.getNextEntry()) != null) {
if (entry.getName().equals(lookup)) {
Log.w("tildefriends", "Extracting " + entry.getName());
FileOutputStream out = new FileOutputStream(getFilesDir().toString().concat("/tildefriends"));
byte[] buffer = new byte[32768];
int count;
while ((count = zip.read(buffer)) != -1) {
out.write(buffer, 0, count);
try (FileOutputStream out = new FileOutputStream(getFilesDir().toString().concat("/tildefriends"))) {
byte[] buffer = new byte[32768];
int count;
while ((count = zip.read(buffer)) != -1) {
out.write(buffer, 0, count);
}
out.close();
new File(getFilesDir().toString() + "/tildefriends").setExecutable(true);
} finally {
}
out.close();
new File(getFilesDir().toString() + "/tildefriends").setExecutable(true);
}
zip.closeEntry();
}