整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3
以下内容为反编译后的 o000000O.java 源代码,内容仅作参考
package com.od.OooooO0;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.MimeTypeMap;
import android.widget.Toast;
import com.sigmob.sdk.archives.tar.d;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;
import org.devio.takephoto.R$string;
import org.devio.takephoto.model.TException;
import org.devio.takephoto.model.TExceptionType;
public class o000000O {
private static final String OooO00o = o0O0O00.class.getName();
public static boolean OooO00o(Context context, String str) {
boolean z = !TextUtils.isEmpty(str) && ".jpg|.gif|.png|.bmp|.jpeg|.webp|".contains(str.toLowerCase());
if (!z) {
Toast.makeText(context, context.getResources().getText(R$string.tip_type_not_image), 0).show();
}
return z;
}
public static String OooO0O0(Activity activity, Uri uri) {
String fileExtensionFromUrl;
if ("content".equals(uri.getScheme())) {
fileExtensionFromUrl = MimeTypeMap.getSingleton().getExtensionFromMimeType(activity.getContentResolver().getType(uri));
if (TextUtils.isEmpty(fileExtensionFromUrl)) {
fileExtensionFromUrl = MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(new File(uri.getPath())).toString());
}
} else {
fileExtensionFromUrl = MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(new File(uri.getPath())).toString());
if (TextUtils.isEmpty(fileExtensionFromUrl)) {
fileExtensionFromUrl = MimeTypeMap.getSingleton().getExtensionFromMimeType(activity.getContentResolver().getType(uri));
}
}
return TextUtils.isEmpty(fileExtensionFromUrl) ? OooO0OO(o00000.OooO0Oo(uri, activity).getName()) : fileExtensionFromUrl;
}
public static String OooO0OO(String str) {
return str.substring(str.lastIndexOf("."), str.length());
}
public static File OooO0Oo(Activity activity, Uri uri) throws TException {
String OooO0O0 = OooO0O0(activity, uri);
if (OooO00o(activity, OooO0O0)) {
File externalFilesDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
if (!externalFilesDir.exists()) {
externalFilesDir.mkdirs();
}
return new File(externalFilesDir, UUID.randomUUID().toString() + "." + OooO0O0);
}
throw new TException(TExceptionType.TYPE_NOT_IMAGE);
}
public static void OooO0o(Bitmap bitmap, Uri uri) {
FileOutputStream fileOutputStream;
Throwable th;
IOException e;
if (bitmap == null) {
return;
}
File file = new File(uri.getPath());
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
try {
try {
fileOutputStream = new FileOutputStream(file);
try {
try {
fileOutputStream.write(byteArrayOutputStream.toByteArray());
byteArrayOutputStream.flush();
fileOutputStream.flush();
fileOutputStream.close();
byteArrayOutputStream.close();
} catch (IOException e2) {
e = e2;
e.printStackTrace();
if (fileOutputStream != null) {
fileOutputStream.close();
byteArrayOutputStream.close();
}
}
} catch (Throwable th2) {
th = th2;
if (fileOutputStream != null) {
try {
fileOutputStream.close();
byteArrayOutputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
throw th;
}
} catch (IOException e4) {
e4.printStackTrace();
}
} catch (IOException e5) {
fileOutputStream = null;
e = e5;
} catch (Throwable th3) {
fileOutputStream = null;
th = th3;
if (fileOutputStream != null) {
}
throw th;
}
}
public static void OooO0o0(InputStream inputStream, File file) throws TException {
FileOutputStream fileOutputStream;
if (file != null) {
FileOutputStream fileOutputStream2 = null;
try {
try {
fileOutputStream = new FileOutputStream(file);
} catch (IOException e) {
e = e;
}
} catch (Throwable th) {
th = th;
}
try {
byte[] bArr = new byte[d.b];
while (true) {
int read = inputStream.read(bArr);
if (read != -1) {
fileOutputStream.write(bArr, 0, read);
} else {
try {
fileOutputStream.flush();
fileOutputStream.close();
inputStream.close();
return;
} catch (IOException e2) {
e2.printStackTrace();
return;
}
}
}
} catch (IOException e3) {
e = e3;
fileOutputStream2 = fileOutputStream;
String str = OooO00o;
Log.e(str, "InputStream 写入文件出错:" + e.toString());
throw new TException(TExceptionType.TYPE_WRITE_FAIL);
} catch (Throwable th2) {
th = th2;
fileOutputStream2 = fileOutputStream;
try {
fileOutputStream2.flush();
fileOutputStream2.close();
inputStream.close();
} catch (IOException e4) {
e4.printStackTrace();
}
throw th;
}
} else {
Log.i(OooO00o, "inputStreamToFile:file not be null");
throw new TException(TExceptionType.TYPE_WRITE_FAIL);
}
}
}