diff --git a/CHANGELOG.md b/CHANGELOG.md index 271661c8d..c121e09b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ------------------------------------------------------------------------------------------------------------- -## 5.3.6 (2020-05-25) +## 5.3.6 (2020-05-30) ### 新特性 * 【core 】 NumberConverter Long类型增加日期转换(pr#872@Github) @@ -25,6 +25,10 @@ * 【cache 】 超时缓存使用的线程池大小默认为1(issue#890@Github) * 【poi 】 ExcelSaxReader支持handleCell方法 * 【core 】 Snowflake容忍2秒内的时间回拨(issue#I1IGDX@Gitee) +* 【core 】 StrUtil增加isAllNotEmpty、isAllNotBlank方法(pr#895@Github) +* 【core 】 DateUtil增加dayOfYear方法(pr#895@Github) +* 【core 】 DateUtil增加dayOfYear方法(pr#895@Github) +* 【http 】 HttpUtil增加downloadBytes方法(pr#895@Github) ### Bug修复 * 【core 】 修复SimpleCache死锁问题(issue#I1HOKB@Gitee) diff --git a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java b/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java index bd4d160b6..8a8580096 100644 --- a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java @@ -252,16 +252,14 @@ public class DateUtil extends CalendarUtil { } /** - * 获得指定日期是这个日期所在月份的第几天
+ * 获得指定日期是这个日期所在年的第几天 * * @param date 日期 * @return 天 - * issue#896@Github + * @since 5.3.6 */ public static int dayOfYear(Date date) { - Calendar instance = Calendar.getInstance(); - instance.setTime(date); - return instance.get(Calendar.DAY_OF_YEAR); + return DateTime.of(date).getField(DateField.DAY_OF_YEAR); } /** diff --git a/hutool-core/src/main/java/cn/hutool/core/util/StrUtil.java b/hutool-core/src/main/java/cn/hutool/core/util/StrUtil.java index 9b11156d6..d8dea3817 100644 --- a/hutool-core/src/main/java/cn/hutool/core/util/StrUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/util/StrUtil.java @@ -350,12 +350,23 @@ public class StrUtil { * * @param args 被检查的对象,一个或者多个 * @return 是否都不为空 - * @since 5.3.5 + * @since 5.3.6 */ public static boolean isAllNotEmpty(CharSequence... args) { return false == hasEmpty(args); } + /** + * 是否存都不为{@code null}或空对象或空白符的对象,通过{@link StrUtil#hasBlank(CharSequence...)} 判断元素 + * + * @param args 被检查的对象,一个或者多个 + * @return 是否都不为空 + * @since 5.3.6 + */ + public static boolean isAllNotBlank(CharSequence... args) { + return false == hasBlank(args); + } + /** * 检查字符串是否为null、“null”、“undefined” * diff --git a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java b/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java index 0ad059d8b..39a0c3f79 100644 --- a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java +++ b/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java @@ -353,20 +353,19 @@ public class HttpUtil { } /** - - * 下载远程文件数据 + * 下载远程文件数据,支持30x跳转 * - * @param url 请求的url + * @param url 请求的url * @return 文件数据 + * @since 5.3.6 */ public static byte[] downloadBytes(String url) { if (StrUtil.isBlank(url)) { throw new NullPointerException("[url] is null!"); } - HttpRequest request = new HttpRequest(url); - request.setFollowRedirects(true); - final HttpResponse response = request.executeAsync(); + final HttpResponse response = HttpRequest.get(url) + .setFollowRedirects(true).executeAsync(); if (false == response.isOk()) { throw new HttpException("Server response error with status code: [{}]", response.getStatus()); }