mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-04 19:48:54 +01:00
60 lines
2 KiB
Java
60 lines
2 KiB
Java
package org.apache.commons.io;
|
|
|
|
import androidx.core.os.ParcelCompat$$ExternalSyntheticOutline0;
|
|
import com.amazon.alexa.ra.core.ui.markdown.parser.formatter.MarkdownConstants;
|
|
import defpackage.a$$ExternalSyntheticOutline0;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import okio.Buffer$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes10.dex */
|
|
public class FileDeleteStrategy {
|
|
private final String name;
|
|
public static final FileDeleteStrategy NORMAL = new FileDeleteStrategy("Normal");
|
|
public static final FileDeleteStrategy FORCE = new ForceFileDeleteStrategy();
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static class ForceFileDeleteStrategy extends FileDeleteStrategy {
|
|
public ForceFileDeleteStrategy() {
|
|
super("Force");
|
|
}
|
|
|
|
@Override // org.apache.commons.io.FileDeleteStrategy
|
|
public boolean doDelete(File file) throws IOException {
|
|
FileUtils.forceDelete(file);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public FileDeleteStrategy(String str) {
|
|
this.name = str;
|
|
}
|
|
|
|
public void delete(File file) throws IOException {
|
|
if (!file.exists() || doDelete(file)) {
|
|
return;
|
|
}
|
|
Buffer$$ExternalSyntheticBUOutline0.m$2(ParcelCompat$$ExternalSyntheticOutline0.m(file, "Deletion failed: "));
|
|
}
|
|
|
|
public boolean deleteQuietly(File file) {
|
|
if (file == null || !file.exists()) {
|
|
return true;
|
|
}
|
|
try {
|
|
return doDelete(file);
|
|
} catch (IOException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public boolean doDelete(File file) throws IOException {
|
|
FileUtils.delete(file);
|
|
return true;
|
|
}
|
|
|
|
public String toString() {
|
|
return a$$ExternalSyntheticOutline0.m(new StringBuilder("FileDeleteStrategy["), this.name, MarkdownConstants.RIGHT_BRACKET);
|
|
}
|
|
}
|