fix comment

This commit is contained in:
Looly 2021-08-02 20:27:41 +08:00
parent 854f3dcce6
commit c7d2d389f0
3 changed files with 16 additions and 14 deletions

View File

@ -406,7 +406,7 @@ public class PathUtil {
* @return byte数组 * @return byte数组
* @since 5.5.4 * @since 5.5.4
*/ */
public static byte[] readBytes(Path path){ public static byte[] readBytes(Path path) {
try { try {
return Files.readAllBytes(path); return Files.readAllBytes(path);
} catch (IOException e) { } catch (IOException e) {
@ -562,7 +562,7 @@ public class PathUtil {
* @return 转换后的Path * @return 转换后的Path
* @since 5.5.5 * @since 5.5.5
*/ */
public static Path toAbsNormal(Path path){ public static Path toAbsNormal(Path path) {
Assert.notNull(path); Assert.notNull(path);
return path.toAbsolutePath().normalize(); return path.toAbsolutePath().normalize();
} }
@ -572,8 +572,8 @@ public class PathUtil {
* *
* @param file 文件 * @param file 文件
* @return MimeType * @return MimeType
* @since 5.5.5
* @see Files#probeContentType(Path) * @see Files#probeContentType(Path)
* @since 5.5.5
*/ */
public static String getMimeType(Path file) { public static String getMimeType(Path file) {
try { try {
@ -616,15 +616,15 @@ public class PathUtil {
* 删除文件不追踪软链 * 删除文件不追踪软链
* *
* @param path 文件对象 * @param path 文件对象
* @throws IORuntimeException IO异常 * @throws IOException IO异常
* @since 5.7.7 * @since 5.7.7
*/ */
protected static void delFile(Path path) throws IOException { protected static void delFile(Path path) throws IOException {
try { try {
Files.delete(path); Files.delete(path);
}catch (AccessDeniedException e) { } catch (AccessDeniedException e) {
// 可能遇到只读文件无法删除.使用 file 方法删除 // 可能遇到只读文件无法删除.使用 file 方法删除
if(false == path.toFile().delete()) { if (false == path.toFile().delete()) {
throw e; throw e;
} }
} }

View File

@ -30,6 +30,7 @@ public class MoveVisitor extends SimpleFileVisitor<Path> {
* *
* @param source 源Path * @param source 源Path
* @param target 目标Path * @param target 目标Path
* @param copyOptions 拷贝移动选项
*/ */
public MoveVisitor(Path source, Path target, CopyOption... copyOptions) { public MoveVisitor(Path source, Path target, CopyOption... copyOptions) {
if(PathUtil.exists(target, false) && false == PathUtil.isDirectory(target)){ if(PathUtil.exists(target, false) && false == PathUtil.isDirectory(target)){

View File

@ -128,7 +128,7 @@ public class MethodHandleUtil {
* MethodHandleUtil::invokeDefault); * MethodHandleUtil::invokeDefault);
* </pre> * </pre>
* *
* @param <T> 返回结果类型 * @param <T> 返回结果类型
* @param obj 接口的子对象或代理对象 * @param obj 接口的子对象或代理对象
* @param methodName 方法名称 * @param methodName 方法名称
* @param args 参数 * @param args 参数
@ -148,7 +148,7 @@ public class MethodHandleUtil {
/** /**
* 执行接口或对象中的方法 * 执行接口或对象中的方法
* *
* @param <T> 返回结果类型 * @param <T> 返回结果类型
* @param obj 接口的子对象或代理对象 * @param obj 接口的子对象或代理对象
* @param method 方法 * @param method 方法
* @param args 参数 * @param args 参数
@ -174,7 +174,7 @@ public class MethodHandleUtil {
* MethodHandleUtil::invoke); * MethodHandleUtil::invoke);
* </pre> * </pre>
* *
* @param <T> 返回结果类型 * @param <T> 返回结果类型
* @param obj 接口的子对象或代理对象 * @param obj 接口的子对象或代理对象
* @param method 方法 * @param method 方法
* @param args 参数 * @param args 参数
@ -200,10 +200,11 @@ public class MethodHandleUtil {
* MethodHandleUtil::invoke); * MethodHandleUtil::invoke);
* </pre> * </pre>
* *
* @param <T> 返回结果类型 * @param <T> 返回结果类型
* @param obj 接口的子对象或代理对象 * @param isSpecial 是否为特殊方法privatestatic等
* @param method 方法 * @param obj 接口的子对象或代理对象
* @param args 参数 * @param method 方法
* @param args 参数
* @return 结果 * @return 结果
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -214,7 +215,7 @@ public class MethodHandleUtil {
try { try {
MethodHandle handle = isSpecial ? lookup.unreflectSpecial(method, declaringClass) MethodHandle handle = isSpecial ? lookup.unreflectSpecial(method, declaringClass)
: lookup.unreflect(method); : lookup.unreflect(method);
if(null != obj){ if (null != obj) {
handle = handle.bindTo(obj); handle = handle.bindTo(obj);
} }
return (T) handle.invokeWithArguments(args); return (T) handle.invokeWithArguments(args);