Use try-with-resources

This commit is contained in:
TacoTheDank
2022-09-02 03:04:30 -04:00
committed by Cameron Gutman
parent 51594e00b8
commit a96e508ffb
11 changed files with 97 additions and 134 deletions
@@ -887,8 +887,7 @@ public class MediaCodecHelper {
public static String readCpuinfo() throws Exception {
StringBuilder cpuInfo = new StringBuilder();
BufferedReader br = new BufferedReader(new FileReader(new File("/proc/cpuinfo")));
try {
try (final BufferedReader br = new BufferedReader(new FileReader(new File("/proc/cpuinfo")))) {
for (;;) {
int ch = br.read();
if (ch == -1)
@@ -897,8 +896,6 @@ public class MediaCodecHelper {
}
return cpuInfo.toString();
} finally {
br.close();
}
}