mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-24 18:04:54 +08:00
fix test
This commit is contained in:
parent
bf8906eb48
commit
fefd88b358
@ -1,7 +1,6 @@
|
|||||||
package cn.hutool.core.net;
|
package cn.hutool.core.net;
|
||||||
|
|
||||||
import cn.hutool.core.util.CharUtil;
|
import cn.hutool.core.util.CharUtil;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
|
||||||
import cn.hutool.core.util.HexUtil;
|
import cn.hutool.core.util.HexUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
@ -318,16 +317,14 @@ public class URLEncoder implements Serializable {
|
|||||||
* 将URL中的字符串编码为%形式
|
* 将URL中的字符串编码为%形式
|
||||||
*
|
*
|
||||||
* @param path 需要编码的字符串
|
* @param path 需要编码的字符串
|
||||||
* @param charset 编码
|
* @param charset 编码, {@code null}返回原字符串,表示不编码
|
||||||
* @return 编码后的字符串
|
* @return 编码后的字符串
|
||||||
*/
|
*/
|
||||||
public String encode(String path, Charset charset) {
|
public String encode(String path, Charset charset) {
|
||||||
if (StrUtil.isEmpty(path)) {
|
if (null == charset || StrUtil.isEmpty(path)) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
if(null == charset){
|
|
||||||
charset = CharsetUtil.CHARSET_UTF_8;
|
|
||||||
}
|
|
||||||
final StringBuilder rewrittenPath = new StringBuilder(path.length());
|
final StringBuilder rewrittenPath = new StringBuilder(path.length());
|
||||||
ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(buf, charset);
|
OutputStreamWriter writer = new OutputStreamWriter(buf, charset);
|
||||||
|
@ -19,7 +19,7 @@ import java.util.function.Function;
|
|||||||
*/
|
*/
|
||||||
public class StrJoiner implements Appendable, Serializable {
|
public class StrJoiner implements Appendable, Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Appendable appendable;
|
private Appendable appendable;
|
||||||
private CharSequence delimiter;
|
private CharSequence delimiter;
|
||||||
private CharSequence prefix;
|
private CharSequence prefix;
|
||||||
@ -232,10 +232,12 @@ public class StrJoiner implements Appendable, Serializable {
|
|||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public <T> StrJoiner append(Iterator<T> iterator) {
|
public <T> StrJoiner append(Iterator<T> iterator) {
|
||||||
if (null == iterator) {
|
if (null != iterator) {
|
||||||
return this;
|
while (iterator.hasNext()) {
|
||||||
|
append(iterator.next());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return append(iterator, (t) -> StrJoiner.of(this).append(t).toString());
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user