add method

This commit is contained in:
Looly
2021-03-12 23:08:27 +08:00
parent cc7183e1be
commit 183a820206
2 changed files with 7 additions and 6 deletions

View File

@@ -17,6 +17,7 @@
* 【core 】 增加汉字转阿拉伯数字Convert.chineseToNumberpr#1469@Github
* 【json 】 JSONUtil增加getByPath方法支持默认值issue#1470@Github
* 【crypto 】 SecureUtil增加hmacSha256方法pr#1473@Github
* 【core 】 FileTypeUtil判断流增加文件名辅助判断pr#1471@Github
### Bug修复
* 【socket 】 修复Client创建失败资源未释放问题。

View File

@@ -1,5 +1,7 @@
package cn.hutool.core.io;
import cn.hutool.core.util.StrUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -7,8 +9,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentSkipListMap;
import cn.hutool.core.util.StrUtil;
/**
* 文件类型判断工具类
*
@@ -111,7 +111,7 @@ public class FileTypeUtil {
* 根据文件流的头部信息获得文件类型
*
* @param fileStreamHexHead 文件流头部16进制字符串
* @return 文件类型,未找到为<code>null</code>
* @return 文件类型,未找到为{@code null}
*/
public static String getType(String fileStreamHexHead) {
for (Entry<String, String> fileTypeEntry : FILE_TYPE_MAP.entrySet()) {
@@ -126,7 +126,7 @@ public class FileTypeUtil {
* 根据文件流的头部信息获得文件类型
*
* @param in {@link InputStream}
* @return 类型,文件的扩展名,未找到为<code>null</code>
* @return 类型,文件的扩展名,未找到为{@code null}
* @throws IORuntimeException 读取流引起的异常
*/
public static String getType(InputStream in) throws IORuntimeException {
@@ -144,7 +144,7 @@ public class FileTypeUtil {
* </pre>
* @param in {@link InputStream}
* @param filename 文件名
* @return 类型,文件的扩展名,未找到为<code>null</code>
* @return 类型,文件的扩展名,未找到为{@code null}
* @throws IORuntimeException 读取流引起的异常
*/
public static String getType(InputStream in, String filename) {
@@ -189,7 +189,7 @@ public class FileTypeUtil {
* </pre>
*
* @param file 文件 {@link File}
* @return 类型,文件的扩展名,未找到为<code>null</code>
* @return 类型,文件的扩展名,未找到为{@code null}
* @throws IORuntimeException 读取文件引起的异常
*/
public static String getType(File file) throws IORuntimeException {