mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
🧁release 5.7.5
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-parent</artifactId>
|
||||
<version>5.7.5-SNAPSHOT</version>
|
||||
<version>5.7.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hutool-core</artifactId>
|
||||
|
@@ -82,25 +82,6 @@ public class CharsetDetector {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断编码,判断后会关闭流
|
||||
*
|
||||
* @param in 流
|
||||
* @param charset 编码
|
||||
* @return 编码
|
||||
*/
|
||||
private static Charset detectCharset(InputStream in, Charset charset) throws IOException {
|
||||
CharsetDecoder decoder = charset.newDecoder();
|
||||
|
||||
final byte[] buffer = new byte[512];
|
||||
while (in.read(buffer) > -1) {
|
||||
if (identify(buffer, decoder)) {
|
||||
return charset;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过try的方式测试指定bytes是否可以被解码,从而判断是否为指定编码
|
||||
*
|
||||
|
Reference in New Issue
Block a user