mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
change changelog
This commit is contained in:
commit
c28156272c
@ -3,12 +3,13 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.7.6 (2021-07-19)
|
||||
# 5.7.6 (2021-07-23)
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 增加FieldsComparator(pr#374@Gitee)
|
||||
* 【core 】 FileUtil.del采用Files.delete实现
|
||||
* 【core 】 改进Base64.isBase64方法增加等号判断(issue#1710@Github)
|
||||
* 【core 】 Sftp增加syncUpload方法(pr#375@Gitee)
|
||||
* 【core 】 改进NetUtil.getLocalHost逻辑(issue#1717@Github)
|
||||
|
||||
### 🐞Bug修复
|
||||
|
@ -1382,8 +1382,23 @@ public class FileUtil extends PathUtil {
|
||||
* @param file 文件对象
|
||||
* @param lastModifyTime 上次的改动时间
|
||||
* @return 是否被改动
|
||||
* @deprecated 拼写错误,请使用{@link #isModified(File, long)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isModifed(File file, long lastModifyTime) {
|
||||
return isModified(file,lastModifyTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断文件是否被改动<br>
|
||||
* 如果文件对象为 null 或者文件不存在,被视为改动
|
||||
*
|
||||
* @param file 文件对象
|
||||
* @param lastModifyTime 上次的改动时间
|
||||
* @return 是否被改动
|
||||
*/
|
||||
public static boolean isModified(File file, long lastModifyTime) {
|
||||
if (null == file || false == file.exists()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ public class Sftp extends AbstractFtp {
|
||||
|
||||
@Override
|
||||
public boolean mkdir(String dir) {
|
||||
if(isDir(dir)){
|
||||
if (isDir(dir)) {
|
||||
// 目录已经存在,创建直接返回
|
||||
return true;
|
||||
}
|
||||
@ -332,7 +332,7 @@ public class Sftp extends AbstractFtp {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDir(String dir){
|
||||
public boolean isDir(String dir) {
|
||||
final SftpATTRS sftpATTRS;
|
||||
try {
|
||||
sftpATTRS = this.channel.stat(dir);
|
||||
@ -423,6 +423,36 @@ public class Sftp extends AbstractFtp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将本地文件或者文件夹同步(覆盖)上传到远程路径
|
||||
*
|
||||
* @param file 文件或者文件夹
|
||||
* @param remotePath 远程路径
|
||||
* @since 5.7.6
|
||||
*/
|
||||
public void syncUpload(File file, String remotePath) {
|
||||
if (false == FileUtil.exist(file)) {
|
||||
return;
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
for (File fileItem : files) {
|
||||
if (fileItem.isDirectory()) {
|
||||
String mkdir = FileUtil.normalize(remotePath + "/" + fileItem.getName());
|
||||
this.syncUpload(fileItem, mkdir);
|
||||
} else {
|
||||
this.syncUpload(fileItem, remotePath);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.mkDirs(remotePath);
|
||||
this.upload(remotePath, file);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean upload(String destPath, File file) {
|
||||
put(FileUtil.getAbsolutePath(file), destPath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user