add webp support

This commit is contained in:
Looly 2022-06-09 12:09:12 +08:00
parent 84711ad790
commit dd0fac8889
4 changed files with 28 additions and 16 deletions

View File

@ -3,12 +3,13 @@
-------------------------------------------------------------------------------------------------------------
# 5.8.3.M1 (2022-06-08)
# 5.8.3.M1 (2022-06-09)
### 🐣新特性
* 【extra 】 mail增加writeTimeout参数支持issue#2355@Github
* 【core 】 FileTypeUtil增加pptx扩展名支持issue#I5A0GO@Gitee
* 【core 】 IterUtil.get增加判空issue#I5B12A@Gitee
* 【core 】 FileTypeUtil增加webp类型判断issue#I5BGTF@Gitee
### 🐞Bug修复
* 【core 】 修复NumberUtil.isXXX空判断错误issue#2356@Github
* 【core 】 修复Convert.toSBC空指针问题issue#I5APKK@Gitee

View File

@ -83,6 +83,8 @@ public class FileTypeUtil {
FILE_TYPE_MAP.put("AC9EBD8F", "qdf"); // Quicken (qdf)
FILE_TYPE_MAP.put("E3828596", "pwl"); // Windows Password (pwl)
FILE_TYPE_MAP.put("2E7261FD", "ram"); // Real Audio (ram)
// https://stackoverflow.com/questions/45321665/magic-number-for-google-image-format
FILE_TYPE_MAP.put("52494646", "webp");
}
/**

View File

@ -75,4 +75,14 @@ public class FileTypeUtilTest {
inputStream.reset();
}
@Test
@Ignore
public void webpTest(){
// https://gitee.com/dromara/hutool/issues/I5BGTF
final File file = FileUtil.file("d:/test/a.webp");
final BufferedInputStream inputStream = FileUtil.getInputStream(file);
final String type = FileTypeUtil.getType(inputStream);
Console.log(type);
}
}

View File

@ -17,14 +17,6 @@ public class JavaInfo implements Serializable {
private final String JAVA_VENDOR = SystemUtil.get("java.vendor", false);
private final String JAVA_VENDOR_URL = SystemUtil.get("java.vendor.url", false);
// 1.1--1.3能否识别?
private final boolean IS_JAVA_1_1 = getJavaVersionMatches("1.1");
private final boolean IS_JAVA_1_2 = getJavaVersionMatches("1.2");
private final boolean IS_JAVA_1_3 = getJavaVersionMatches("1.3");
private final boolean IS_JAVA_1_4 = getJavaVersionMatches("1.4");
private final boolean IS_JAVA_1_5 = getJavaVersionMatches("1.5");
private final boolean IS_JAVA_1_6 = getJavaVersionMatches("1.6");
private final boolean IS_JAVA_1_7 = getJavaVersionMatches("1.7");
private final boolean IS_JAVA_1_8 = getJavaVersionMatches("1.8");
private final boolean IS_JAVA_9 = getJavaVersionMatches("9");
private final boolean IS_JAVA_10 = getJavaVersionMatches("10");
@ -161,8 +153,9 @@ public class JavaInfo implements Serializable {
*
* @return 如果当前Java版本为1.1则返回{@code true}
*/
@Deprecated
public final boolean isJava1_1() {
return IS_JAVA_1_1;
return false;
}
/**
@ -173,8 +166,9 @@ public class JavaInfo implements Serializable {
*
* @return 如果当前Java版本为1.2则返回{@code true}
*/
@Deprecated
public final boolean isJava1_2() {
return IS_JAVA_1_2;
return false;
}
/**
@ -185,8 +179,9 @@ public class JavaInfo implements Serializable {
*
* @return 如果当前Java版本为1.3则返回{@code true}
*/
@Deprecated
public final boolean isJava1_3() {
return IS_JAVA_1_3;
return false;
}
/**
@ -197,8 +192,9 @@ public class JavaInfo implements Serializable {
*
* @return 如果当前Java版本为1.4则返回{@code true}
*/
@Deprecated
public final boolean isJava1_4() {
return IS_JAVA_1_4;
return false;
}
/**
@ -209,8 +205,9 @@ public class JavaInfo implements Serializable {
*
* @return 如果当前Java版本为1.5则返回{@code true}
*/
@Deprecated
public final boolean isJava1_5() {
return IS_JAVA_1_5;
return false;
}
/**
@ -221,8 +218,9 @@ public class JavaInfo implements Serializable {
*
* @return 如果当前Java版本为1.6则返回{@code true}
*/
@Deprecated
public final boolean isJava1_6() {
return IS_JAVA_1_6;
return false;
}
/**
@ -233,8 +231,9 @@ public class JavaInfo implements Serializable {
*
* @return 如果当前Java版本为1.7则返回{@code true}
*/
@Deprecated
public final boolean isJava1_7() {
return IS_JAVA_1_7;
return false;
}
/**