This commit is contained in:
Looly
2023-03-23 23:50:59 +08:00
parent e81a63c6ad
commit c8309ef5fb
57 changed files with 764 additions and 505 deletions

View File

@@ -4,8 +4,9 @@ import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.net.LocalPortGenerator;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.text.StrUtil;
import cn.hutool.core.util.ByteUtil;
import cn.hutool.core.util.CharsetUtil;
import com.jcraft.jsch.*;
import java.io.IOException;
@@ -463,7 +464,7 @@ public class JschUtil {
charset = CharsetUtil.UTF_8;
}
final ChannelExec channel = (ChannelExec) createChannel(session, ChannelType.EXEC);
channel.setCommand(StrUtil.bytes(cmd, charset));
channel.setCommand(ByteUtil.toBytes(cmd, charset));
channel.setInputStream(null);
channel.setErrStream(errStream);
InputStream in = null;
@@ -503,7 +504,7 @@ public class JschUtil {
out = shell.getOutputStream();
in = shell.getInputStream();
out.write(StrUtil.bytes(cmd, charset));
out.write(ByteUtil.toBytes(cmd, charset));
out.flush();
return IoUtil.read(in, charset);

View File

@@ -1,6 +1,6 @@
package cn.hutool.extra.servlet;
import cn.hutool.core.text.StrUtil;
import cn.hutool.core.util.ByteUtil;
import org.junit.Ignore;
import org.junit.Test;
@@ -21,7 +21,7 @@ public class ServletUtilTest {
@Ignore
public void writeTest() {
final HttpServletResponse response = null;
final byte[] bytes = StrUtil.utf8Bytes("地球是我们共同的家园,需要大家珍惜.");
final byte[] bytes = ByteUtil.toUtf8Bytes("地球是我们共同的家园,需要大家珍惜.");
//下载文件
// 这里没法直接测试,直接写到这里,方便调用;
@@ -38,7 +38,7 @@ public class ServletUtilTest {
@Ignore
public void jakartaWriteTest() {
final jakarta.servlet.http.HttpServletResponse response = null;
final byte[] bytes = StrUtil.utf8Bytes("地球是我们共同的家园,需要大家珍惜.");
final byte[] bytes = ByteUtil.toUtf8Bytes("地球是我们共同的家园,需要大家珍惜.");
//下载文件
// 这里没法直接测试,直接写到这里,方便调用;