From 79b6b784d1e27daebdda86273448c4ba7747e384 Mon Sep 17 00:00:00 2001 From: XinYiWorld <1349308479@qq.com> Date: Thu, 25 May 2017 11:39:39 +0800 Subject: [PATCH] =?UTF-8?q?FileUtil=E5=A2=9E=E5=8A=A0=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../czbasedevtool/base/utils/io/FileUtil.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/utils/io/FileUtil.java b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/utils/io/FileUtil.java index 30a0e11..815b21d 100644 --- a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/utils/io/FileUtil.java +++ b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/utils/io/FileUtil.java @@ -3,6 +3,7 @@ import android.os.Environment; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.util.Log; import com.xinyi.czbasedevtool.base.interfaces.listener.OnTaskDoneListener; import com.xinyi.czbasedevtool.base.manager.SystemStaticInstanceManager; @@ -56,6 +57,20 @@ private FileUtil(){ ExceptionUtil.throwRunmtimeExcpetionInPrivateConstructor(FileUtil.class); } + /** + * 文件是否合法,微信热补丁。 + * @param file + * @return + */ + public static boolean isLegalFile(File file) { + boolean c1 = file != null; + boolean c2 = file.exists(); + boolean c3 = file.canRead(); + boolean c4 = file.isFile(); + long c5 = file.length(); + Log.d(TAG, "isLegalFile: " + c1 + "," + c2 + "," + c3 + "," + c4 + "," + c5); + return c1 && c2 && c3 && c4 && c5 > 0; + } //文件读写操作 /**