mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +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)
|
* 【core 】 NumberConverter Long类型增加日期转换(pr#872@Github)
|
||||||
@ -25,6 +25,10 @@
|
|||||||
* 【cache 】 超时缓存使用的线程池大小默认为1(issue#890@Github)
|
* 【cache 】 超时缓存使用的线程池大小默认为1(issue#890@Github)
|
||||||
* 【poi 】 ExcelSaxReader支持handleCell方法
|
* 【poi 】 ExcelSaxReader支持handleCell方法
|
||||||
* 【core 】 Snowflake容忍2秒内的时间回拨(issue#I1IGDX@Gitee)
|
* 【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修复
|
### Bug修复
|
||||||
* 【core 】 修复SimpleCache死锁问题(issue#I1HOKB@Gitee)
|
* 【core 】 修复SimpleCache死锁问题(issue#I1HOKB@Gitee)
|
||||||
|
@ -252,16 +252,14 @@ public class DateUtil extends CalendarUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定日期是这个日期所在月份的第几天<br>
|
* 获得指定日期是这个日期所在年的第几天
|
||||||
*
|
*
|
||||||
* @param date 日期
|
* @param date 日期
|
||||||
* @return 天
|
* @return 天
|
||||||
* issue#896@Github
|
* @since 5.3.6
|
||||||
*/
|
*/
|
||||||
public static int dayOfYear(Date date) {
|
public static int dayOfYear(Date date) {
|
||||||
Calendar instance = Calendar.getInstance();
|
return DateTime.of(date).getField(DateField.DAY_OF_YEAR);
|
||||||
instance.setTime(date);
|
|
||||||
return instance.get(Calendar.DAY_OF_YEAR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -350,12 +350,23 @@ public class StrUtil {
|
|||||||
*
|
*
|
||||||
* @param args 被检查的对象,一个或者多个
|
* @param args 被检查的对象,一个或者多个
|
||||||
* @return 是否都不为空
|
* @return 是否都不为空
|
||||||
* @since 5.3.5
|
* @since 5.3.6
|
||||||
*/
|
*/
|
||||||
public static boolean isAllNotEmpty(CharSequence... args) {
|
public static boolean isAllNotEmpty(CharSequence... args) {
|
||||||
return false == hasEmpty(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”
|
* 检查字符串是否为null、“null”、“undefined”
|
||||||
*
|
*
|
||||||
|
@ -353,20 +353,19 @@ public class HttpUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 下载远程文件数据,支持30x跳转
|
||||||
* 下载远程文件数据
|
|
||||||
*
|
*
|
||||||
* @param url 请求的url
|
* @param url 请求的url
|
||||||
* @return 文件数据
|
* @return 文件数据
|
||||||
|
* @since 5.3.6
|
||||||
*/
|
*/
|
||||||
public static byte[] downloadBytes(String url) {
|
public static byte[] downloadBytes(String url) {
|
||||||
if (StrUtil.isBlank(url)) {
|
if (StrUtil.isBlank(url)) {
|
||||||
throw new NullPointerException("[url] is null!");
|
throw new NullPointerException("[url] is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest(url);
|
final HttpResponse response = HttpRequest.get(url)
|
||||||
request.setFollowRedirects(true);
|
.setFollowRedirects(true).executeAsync();
|
||||||
final HttpResponse response = request.executeAsync();
|
|
||||||
if (false == response.isOk()) {
|
if (false == response.isOk()) {
|
||||||
throw new HttpException("Server response error with status code: [{}]", response.getStatus());
|
throw new HttpException("Server response error with status code: [{}]", response.getStatus());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user