|
|
@ -13,7 +13,7 @@ import java.io.Reader; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.io.Writer; |
|
|
|
import java.io.Writer; |
|
|
|
import java.nio.channels.Channel; |
|
|
|
import java.nio.channels.Channel; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author richie |
|
|
|
* @author richie |
|
|
@ -108,7 +108,7 @@ public class IOKit { |
|
|
|
* @return 读取出来的字符串 |
|
|
|
* @return 读取出来的字符串 |
|
|
|
* @throws UnsupportedEncodingException 编码类型不支持则抛出此异常 |
|
|
|
* @throws UnsupportedEncodingException 编码类型不支持则抛出此异常 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static String inputStream2String(InputStream is, StandardCharsets charset) |
|
|
|
public static String inputStream2String(InputStream is, Charset charset) |
|
|
|
throws UnsupportedEncodingException { |
|
|
|
throws UnsupportedEncodingException { |
|
|
|
return CommonIOUtils.inputStream2String(is, charset.toString()); |
|
|
|
return CommonIOUtils.inputStream2String(is, charset.toString()); |
|
|
|
} |
|
|
|
} |
|
|
@ -196,7 +196,7 @@ public class IOKit { |
|
|
|
* @param encode 读取资源所用的编码 |
|
|
|
* @param encode 读取资源所用的编码 |
|
|
|
* @return 表示资源内容的字符串 |
|
|
|
* @return 表示资源内容的字符串 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static String readResourceAsString(String path, StandardCharsets encode) { |
|
|
|
public static String readResourceAsString(String path, Charset encode) { |
|
|
|
return IOUtils.readResourceAsString(path, encode.toString()); |
|
|
|
return IOUtils.readResourceAsString(path, encode.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|