mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add method and fix GlobalMailAccount
This commit is contained in:
parent
3846985acd
commit
74cb1abeeb
@ -16,6 +16,9 @@
|
||||
* 【core 】 CharUtil and StrUtil增加@(pr#1106@Github)
|
||||
* 【extra 】 优化EMOJ查询逻辑(pr#1112@Github)
|
||||
* 【extra 】 优化CollUtil交并集结果集合设置初始化大小,避免扩容成本(pr#1110@Github)
|
||||
* 【core 】 优化PageUtil彩虹算法(issue#1110@Github)
|
||||
* 【core 】 IoUtil增加readUtf8方法
|
||||
* 【core 】 优化全局邮箱账户初始化逻辑(pr#1114@Github)
|
||||
|
||||
### Bug修复
|
||||
* 【crypto 】 修复SM2验签后无法解密问题(issue#I1W0VP@Gitee)
|
||||
|
@ -214,9 +214,14 @@ public class DateUtil extends CalendarUtil {
|
||||
|
||||
/**
|
||||
* 获得指定日期是所在年份的第几周<br>
|
||||
* 此方法返回值与一周的第一天有关,比如:<br>
|
||||
* 2016年1月3日为周日,如果一周的第一天为周日,那这天是第二周(返回2)<br>
|
||||
* 如果一周的第一天为周一,那这天是第一周(返回1)<br>
|
||||
* 跨年的那个星期得到的结果总是1
|
||||
*
|
||||
* @param date 日期
|
||||
* @return 周
|
||||
* @see DateTime#setFirstDayOfWeek(Week)
|
||||
*/
|
||||
public static int weekOfYear(Date date) {
|
||||
return DateTime.of(date).weekOfYear();
|
||||
|
@ -421,6 +421,18 @@ public class IoUtil {
|
||||
|
||||
// -------------------------------------------------------------------------------------- read start
|
||||
|
||||
/**
|
||||
* 从流中读取UTF8编码的内容
|
||||
*
|
||||
* @param in 输入流
|
||||
* @return 内容
|
||||
* @throws IORuntimeException IO异常
|
||||
* @since 5.4.4
|
||||
*/
|
||||
public static String readUtf8(InputStream in) throws IORuntimeException {
|
||||
return read(in, CharsetUtil.CHARSET_UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从流中读取内容
|
||||
*
|
||||
@ -1251,7 +1263,7 @@ public class IoUtil {
|
||||
* @throws IORuntimeException IO异常
|
||||
* @since 5.4.0
|
||||
*/
|
||||
public static long checksumValue(InputStream in, Checksum checksum){
|
||||
public static long checksumValue(InputStream in, Checksum checksum) {
|
||||
return checksum(in, checksum).getValue();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import cn.hutool.core.text.replacer.ReplacerChain;
|
||||
|
||||
/**
|
||||
* HTML4的ESCAPE
|
||||
* 参考:Commons Lang3
|
||||
*
|
||||
* @author looly
|
||||
*
|
||||
*/
|
||||
|
@ -160,9 +160,10 @@ public class PageUtil {
|
||||
* @return 分页条
|
||||
*/
|
||||
public static int[] rainbow(int pageNo, int totalPage, int displayCount) {
|
||||
boolean isEven = displayCount % 2 == 0;
|
||||
int left = displayCount / 2;
|
||||
int right = displayCount / 2;
|
||||
// displayCount % 2
|
||||
boolean isEven = (displayCount & 1) == 0;
|
||||
int left = displayCount >> 1;
|
||||
int right = displayCount >> 1;
|
||||
|
||||
int length = displayCount;
|
||||
if (isEven) {
|
||||
|
@ -37,4 +37,11 @@ public class EscapeUtilTest {
|
||||
String unescape = EscapeUtil.unescape(escape);
|
||||
Assert.assertEquals(str, unescape);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void escapeSinleQuotesTest(){
|
||||
String str = "'some text with single quotes'";
|
||||
final String s = EscapeUtil.escapeHtml4(str);
|
||||
Assert.assertEquals(str, s);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public enum GlobalMailAccount {
|
||||
for (String mailSettingPath : MailAccount.MAIL_SETTING_PATHS) {
|
||||
try {
|
||||
return new MailAccount(mailSettingPath);
|
||||
} catch (IORuntimeException e) {
|
||||
} catch (IORuntimeException ignore) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class SoapClient extends HttpBase<SoapClient> {
|
||||
* 创建SOAP客户端,默认使用soap1.1版本协议
|
||||
*
|
||||
* @param url WS的URL地址
|
||||
* @return {@link SoapClient}
|
||||
* @return this
|
||||
*/
|
||||
public static SoapClient create(String url) {
|
||||
return new SoapClient(url);
|
||||
@ -104,7 +104,7 @@ public class SoapClient extends HttpBase<SoapClient> {
|
||||
*
|
||||
* @param url WS的URL地址
|
||||
* @param protocol 协议,见{@link SoapProtocol}
|
||||
* @return {@link SoapClient}
|
||||
* @return this
|
||||
*/
|
||||
public static SoapClient create(String url, SoapProtocol protocol) {
|
||||
return new SoapClient(url, protocol);
|
||||
@ -116,7 +116,7 @@ public class SoapClient extends HttpBase<SoapClient> {
|
||||
* @param url WS的URL地址
|
||||
* @param protocol 协议,见{@link SoapProtocol}
|
||||
* @param namespaceURI 方法上的命名空间URI
|
||||
* @return {@link SoapClient}
|
||||
* @return this
|
||||
* @since 4.5.6
|
||||
*/
|
||||
public static SoapClient create(String url, SoapProtocol protocol, String namespaceURI) {
|
||||
|
Loading…
Reference in New Issue
Block a user