mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
pr#895
This commit is contained in:
parent
fce8c35a82
commit
4a302fc2d8
@ -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)
|
||||
|
@ -252,16 +252,14 @@ public class DateUtil extends CalendarUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得指定日期是这个日期所在月份的第几天<br>
|
||||
* 获得指定日期是这个日期所在年的第几天
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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”
|
||||
*
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user