Java 读取文件,判断文件是否还是传输

2023-09-27 08:26:10 浏览数 (1)

目录

代码语言:javascript复制
      //判断文件是否还在更新
        long oldLength;
        long newLength;
        do {
            oldLength = new File(dataPath).length();
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            newLength = new File(dataPath).length();
            log.info("File Uploading >>"   dataPath   ": "   newLength);
        } while (oldLength != newLength);

0 人点赞