mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add method
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
* 【core 】 增加汉字转阿拉伯数字Convert.chineseToNumber(pr#1469@Github)
|
* 【core 】 增加汉字转阿拉伯数字Convert.chineseToNumber(pr#1469@Github)
|
||||||
* 【json 】 JSONUtil增加getByPath方法支持默认值(issue#1470@Github)
|
* 【json 】 JSONUtil增加getByPath方法支持默认值(issue#1470@Github)
|
||||||
* 【crypto 】 SecureUtil增加hmacSha256方法(pr#1473@Github)
|
* 【crypto 】 SecureUtil增加hmacSha256方法(pr#1473@Github)
|
||||||
|
* 【core 】 FileTypeUtil判断流增加文件名辅助判断(pr#1471@Github)
|
||||||
|
|
||||||
### Bug修复
|
### Bug修复
|
||||||
* 【socket 】 修复Client创建失败资源未释放问题。
|
* 【socket 】 修复Client创建失败资源未释放问题。
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package cn.hutool.core.io;
|
package cn.hutool.core.io;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -7,8 +9,6 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ConcurrentSkipListMap;
|
import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件类型判断工具类
|
* 文件类型判断工具类
|
||||||
*
|
*
|
||||||
@@ -111,7 +111,7 @@ public class FileTypeUtil {
|
|||||||
* 根据文件流的头部信息获得文件类型
|
* 根据文件流的头部信息获得文件类型
|
||||||
*
|
*
|
||||||
* @param fileStreamHexHead 文件流头部16进制字符串
|
* @param fileStreamHexHead 文件流头部16进制字符串
|
||||||
* @return 文件类型,未找到为<code>null</code>
|
* @return 文件类型,未找到为{@code null}
|
||||||
*/
|
*/
|
||||||
public static String getType(String fileStreamHexHead) {
|
public static String getType(String fileStreamHexHead) {
|
||||||
for (Entry<String, String> fileTypeEntry : FILE_TYPE_MAP.entrySet()) {
|
for (Entry<String, String> fileTypeEntry : FILE_TYPE_MAP.entrySet()) {
|
||||||
@@ -126,7 +126,7 @@ public class FileTypeUtil {
|
|||||||
* 根据文件流的头部信息获得文件类型
|
* 根据文件流的头部信息获得文件类型
|
||||||
*
|
*
|
||||||
* @param in {@link InputStream}
|
* @param in {@link InputStream}
|
||||||
* @return 类型,文件的扩展名,未找到为<code>null</code>
|
* @return 类型,文件的扩展名,未找到为{@code null}
|
||||||
* @throws IORuntimeException 读取流引起的异常
|
* @throws IORuntimeException 读取流引起的异常
|
||||||
*/
|
*/
|
||||||
public static String getType(InputStream in) throws IORuntimeException {
|
public static String getType(InputStream in) throws IORuntimeException {
|
||||||
@@ -144,7 +144,7 @@ public class FileTypeUtil {
|
|||||||
* </pre>
|
* </pre>
|
||||||
* @param in {@link InputStream}
|
* @param in {@link InputStream}
|
||||||
* @param filename 文件名
|
* @param filename 文件名
|
||||||
* @return 类型,文件的扩展名,未找到为<code>null</code>
|
* @return 类型,文件的扩展名,未找到为{@code null}
|
||||||
* @throws IORuntimeException 读取流引起的异常
|
* @throws IORuntimeException 读取流引起的异常
|
||||||
*/
|
*/
|
||||||
public static String getType(InputStream in, String filename) {
|
public static String getType(InputStream in, String filename) {
|
||||||
@@ -189,7 +189,7 @@ public class FileTypeUtil {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param file 文件 {@link File}
|
* @param file 文件 {@link File}
|
||||||
* @return 类型,文件的扩展名,未找到为<code>null</code>
|
* @return 类型,文件的扩展名,未找到为{@code null}
|
||||||
* @throws IORuntimeException 读取文件引起的异常
|
* @throws IORuntimeException 读取文件引起的异常
|
||||||
*/
|
*/
|
||||||
public static String getType(File file) throws IORuntimeException {
|
public static String getType(File file) throws IORuntimeException {
|
||||||
|
Reference in New Issue
Block a user