|
@@ -20,6 +20,8 @@ import android.util.Log;
|
|
|
|
|
|
import com.luck.picture.lib.tools.BitmapUtils;
|
|
import com.luck.picture.lib.tools.BitmapUtils;
|
|
|
|
|
|
|
|
+import org.w3c.dom.Text;
|
|
|
|
+
|
|
import java.io.BufferedInputStream;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
@@ -1749,21 +1751,32 @@ public final class FileUtils {
|
|
return compressPath;
|
|
return compressPath;
|
|
}
|
|
}
|
|
|
|
|
|
- public static boolean isMatchTargetFileType(String targetType,String filePath){
|
|
|
|
|
|
+ public static boolean isMatchTargetFileType(String targetType, String filePath) {
|
|
try {
|
|
try {
|
|
- if(TextUtils.isEmpty(targetType)){
|
|
|
|
|
|
+ if (TextUtils.isEmpty(targetType)) {
|
|
|
|
+ Log.i("FileUtils", "targetType is null");
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
File file = new File(filePath);
|
|
File file = new File(filePath);
|
|
if (!file.exists()) {
|
|
if (!file.exists()) {
|
|
|
|
+ Log.i("FileUtils", "file is not exist");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
int lastDot = file.getName().lastIndexOf(".");
|
|
int lastDot = file.getName().lastIndexOf(".");
|
|
if (lastDot < 0) {
|
|
if (lastDot < 0) {
|
|
|
|
+ Log.i("FileUtils", "lastDot is 0 isEmpty filetype");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
String type = file.getName().substring(lastDot + 1).toLowerCase();
|
|
String type = file.getName().substring(lastDot + 1).toLowerCase();
|
|
- Log.i("FileUtils","targetType:"+targetType+"-type:"+type);
|
|
|
|
|
|
+ if (TextUtils.isEmpty(type)) {
|
|
|
|
+ Log.i("FileUtils", "isEmpty filetype");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (TextUtils.equals(targetType, "midi")) {
|
|
|
|
+ //兼容下mid格式
|
|
|
|
+ return TextUtils.equals(type, "midi") || TextUtils.equals(type, "mid");
|
|
|
|
+ }
|
|
|
|
+ Log.i("FileUtils", "targetType:" + targetType + "-type:" + type);
|
|
return TextUtils.equals(targetType, type);
|
|
return TextUtils.equals(targetType, type);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|