|
|
@ -7,6 +7,7 @@ import java.nio.charset.Charset;
|
|
|
|
import java.text.NumberFormat;
|
|
|
|
import java.text.NumberFormat;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.Set;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 类型转换器
|
|
|
|
* 类型转换器
|
|
|
@ -784,23 +785,19 @@ public class Convert
|
|
|
|
* @param charset 字符集
|
|
|
|
* @param charset 字符集
|
|
|
|
* @return 字符串
|
|
|
|
* @return 字符串
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static String str(Object obj, Charset charset)
|
|
|
|
public static String str(Object obj, Charset charset) {
|
|
|
|
{
|
|
|
|
if (null == obj) {
|
|
|
|
if (null == obj)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (obj instanceof String)
|
|
|
|
if (obj instanceof String) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return (String) obj;
|
|
|
|
return (String) obj;
|
|
|
|
}
|
|
|
|
} else if (obj instanceof byte[]) {
|
|
|
|
else if (obj instanceof byte[] || obj instanceof Byte[])
|
|
|
|
return str((byte[]) obj, charset);
|
|
|
|
{
|
|
|
|
} else if (obj instanceof Byte[]) {
|
|
|
|
return str((Byte[]) obj, charset);
|
|
|
|
byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj);
|
|
|
|
}
|
|
|
|
return str(bytes, charset);
|
|
|
|
else if (obj instanceof ByteBuffer)
|
|
|
|
} else if (obj instanceof ByteBuffer) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return str((ByteBuffer) obj, charset);
|
|
|
|
return str((ByteBuffer) obj, charset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return obj.toString();
|
|
|
|
return obj.toString();
|
|
|
|