mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-13 09:27:16 +01:00
67 lines
2.1 KiB
Java
67 lines
2.1 KiB
Java
package com.bumptech.glide.disklrucache;
|
|
|
|
import androidx.core.os.ParcelCompat$$ExternalSyntheticOutline0;
|
|
import java.io.Closeable;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.Reader;
|
|
import java.io.StringWriter;
|
|
import java.nio.charset.Charset;
|
|
import okio.Buffer$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes6.dex */
|
|
final class Util {
|
|
static final Charset US_ASCII = Charset.forName("US-ASCII");
|
|
static final Charset UTF_8 = Charset.forName("UTF-8");
|
|
|
|
private Util() {
|
|
}
|
|
|
|
public static void closeQuietly(Closeable closeable) {
|
|
if (closeable != null) {
|
|
try {
|
|
closeable.close();
|
|
} catch (RuntimeException e) {
|
|
throw e;
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void deleteContents(File file) throws IOException {
|
|
File[] listFiles = file.listFiles();
|
|
if (listFiles == null) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m$2(ParcelCompat$$ExternalSyntheticOutline0.m(file, "not a readable directory: "));
|
|
return;
|
|
}
|
|
for (File file2 : listFiles) {
|
|
if (file2.isDirectory()) {
|
|
deleteContents(file2);
|
|
}
|
|
if (!file2.delete()) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m$2(ParcelCompat$$ExternalSyntheticOutline0.m(file2, "failed to delete file: "));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static String readFully(Reader reader) throws IOException {
|
|
try {
|
|
StringWriter stringWriter = new StringWriter();
|
|
char[] cArr = new char[1024];
|
|
while (true) {
|
|
int read = reader.read(cArr);
|
|
if (read == -1) {
|
|
String stringWriter2 = stringWriter.toString();
|
|
reader.close();
|
|
return stringWriter2;
|
|
}
|
|
stringWriter.write(cArr, 0, read);
|
|
}
|
|
} catch (Throwable th) {
|
|
reader.close();
|
|
throw th;
|
|
}
|
|
}
|
|
}
|