/**
* 检测文件是否传输完成
* @param fileName
* @return
* @throws Exception
*/
public static boolean checkFileWritingOn(String fileName) throws Exception{
long oldLen = 0;
long newLen = 0;
File file = new File(fileName);
while(true){
newLen = file.length();
if ((newLen - oldLen) > 0) {
oldLen = newLen;
//System.out.println(file.length());
log.info(fileName + " being transferred");
Thread.sleep(2000);
} else {
//System.out.println("done");
log.info(fileName + " transmit complete");
return true;
}
}
}
* 检测文件是否传输完成
* @param fileName
* @return
* @throws Exception
*/
public static boolean checkFileWritingOn(String fileName) throws Exception{
long oldLen = 0;
long newLen = 0;
File file = new File(fileName);
while(true){
newLen = file.length();
if ((newLen - oldLen) > 0) {
oldLen = newLen;
//System.out.println(file.length());
log.info(fileName + " being transferred");
Thread.sleep(2000);
} else {
//System.out.println("done");
log.info(fileName + " transmit complete");
return true;
}
}
}