118 lines
4.1 KiB
Java
118 lines
4.1 KiB
Java
|
package com.google.firebase.crashlytics.internal.proto;
|
||
|
|
||
|
import java.io.File;
|
||
|
import java.io.FileNotFoundException;
|
||
|
import java.io.FileOutputStream;
|
||
|
import java.io.FilenameFilter;
|
||
|
import java.io.IOException;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class ClsFileOutputStream extends FileOutputStream {
|
||
|
public static final String IN_PROGRESS_SESSION_FILE_EXTENSION = ".cls_temp";
|
||
|
public static final String SESSION_FILE_EXTENSION = ".cls";
|
||
|
public static final FilenameFilter TEMP_FILENAME_FILTER = new FilenameFilter() { // from class: com.google.firebase.crashlytics.internal.proto.ClsFileOutputStream.1
|
||
|
@Override // java.io.FilenameFilter
|
||
|
public boolean accept(File file, String str) {
|
||
|
return str.endsWith(ClsFileOutputStream.IN_PROGRESS_SESSION_FILE_EXTENSION);
|
||
|
}
|
||
|
};
|
||
|
private boolean closed;
|
||
|
private File complete;
|
||
|
private File inProgress;
|
||
|
private final String root;
|
||
|
|
||
|
public ClsFileOutputStream(String str, String str2) throws FileNotFoundException {
|
||
|
this(new File(str), str2);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Illegal instructions before constructor call */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public ClsFileOutputStream(java.io.File r4, java.lang.String r5) throws java.io.FileNotFoundException {
|
||
|
/*
|
||
|
r3 = this;
|
||
|
java.io.File r0 = new java.io.File
|
||
|
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
||
|
r1.<init>()
|
||
|
r1.append(r5)
|
||
|
java.lang.String r2 = ".cls_temp"
|
||
|
r1.append(r2)
|
||
|
java.lang.String r1 = r1.toString()
|
||
|
r0.<init>(r4, r1)
|
||
|
r3.<init>(r0)
|
||
|
r0 = 0
|
||
|
r3.closed = r0
|
||
|
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
||
|
r0.<init>()
|
||
|
r0.append(r4)
|
||
|
java.lang.String r4 = java.io.File.separator
|
||
|
r0.append(r4)
|
||
|
r0.append(r5)
|
||
|
java.lang.String r4 = r0.toString()
|
||
|
r3.root = r4
|
||
|
java.io.File r5 = new java.io.File
|
||
|
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
||
|
r0.<init>()
|
||
|
r0.append(r4)
|
||
|
r0.append(r2)
|
||
|
java.lang.String r4 = r0.toString()
|
||
|
r5.<init>(r4)
|
||
|
r3.inProgress = r5
|
||
|
return
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.crashlytics.internal.proto.ClsFileOutputStream.<init>(java.io.File, java.lang.String):void");
|
||
|
}
|
||
|
|
||
|
@Override // java.io.FileOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
|
||
|
public void close() throws IOException {
|
||
|
synchronized (this) {
|
||
|
if (this.closed) {
|
||
|
return;
|
||
|
}
|
||
|
this.closed = true;
|
||
|
super.flush();
|
||
|
super.close();
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(this.root);
|
||
|
sb.append(SESSION_FILE_EXTENSION);
|
||
|
File file = new File(sb.toString());
|
||
|
if (this.inProgress.renameTo(file)) {
|
||
|
this.inProgress = null;
|
||
|
this.complete = file;
|
||
|
return;
|
||
|
}
|
||
|
String str = "";
|
||
|
if (file.exists()) {
|
||
|
str = " (target already exists)";
|
||
|
} else if (!this.inProgress.exists()) {
|
||
|
str = " (source does not exist)";
|
||
|
}
|
||
|
StringBuilder sb2 = new StringBuilder("Could not rename temp file: ");
|
||
|
sb2.append(this.inProgress);
|
||
|
sb2.append(" -> ");
|
||
|
sb2.append(file);
|
||
|
sb2.append(str);
|
||
|
throw new IOException(sb2.toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void closeInProgressStream() throws IOException {
|
||
|
if (this.closed) {
|
||
|
return;
|
||
|
}
|
||
|
this.closed = true;
|
||
|
super.flush();
|
||
|
super.close();
|
||
|
}
|
||
|
|
||
|
public File getInProgressFile() {
|
||
|
return this.inProgress;
|
||
|
}
|
||
|
|
||
|
public File getCompleteFile() {
|
||
|
return this.complete;
|
||
|
}
|
||
|
}
|