|
@@ -70,10 +70,11 @@ public class CompareFileUtil {
|
|
|
}
|
|
|
|
|
|
public static String getFileMD5String(File file) {
|
|
|
+ FileInputStream in = null;
|
|
|
+ FileChannel ch = null;
|
|
|
try {
|
|
|
-
|
|
|
- FileInputStream in = new FileInputStream(file);
|
|
|
- FileChannel ch = in.getChannel();
|
|
|
+ in = new FileInputStream(file);
|
|
|
+ ch = in.getChannel();
|
|
|
|
|
|
|
|
|
int maxSize=700000000;
|
|
@@ -105,6 +106,21 @@ public class CompareFileUtil {
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
+ }finally{
|
|
|
+ if (null != ch) {
|
|
|
+ try {
|
|
|
+ ch.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (null != in) {
|
|
|
+ try {
|
|
|
+ in.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return null;
|
|
|
}
|