| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * 应用模块名称 |
| | | * FileType 应用模块名称 |
| | | * <p> |
| | | * 代码描述 文件类型判断工具类 |
| | | * <p> |
| | |
| | | */ |
| | | @Slf4j |
| | | public class FileType { |
| | | public static final String NOT_IMAGE_FILE_TYPE = "0000"; |
| | | |
| | | public static String bytesToHexString(byte[] src) { |
| | | private static final String NOT_IMAGE_FILE_TYPE = "0000"; |
| | | |
| | | private static String bytesToHexString(byte[] src) { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | if (src == null || src.length <= 0) { |
| | | return null; |
| | |
| | | * |
| | | * @param args |
| | | */ |
| | | // public static void main(String[] args) throws Exception { |
| | | // FileInputStream is = new FileInputStream("D:\\Pictures\\11.png"); |
| | | // byte[] b = new byte[3]; |
| | | // is.read(b, 0, b.length); |
| | | // String photo = bytesToHexString(b); |
| | | // photo = photo.toUpperCase(); |
| | | // System.out.println("头文件是:" + photo); |
| | | // String ooo = TypeDict.checkType(photo); |
| | | // System.out.println("后缀名是:" + ooo); |
| | | // } |
| | | // public static void main(String[] args) throws Exception { |
| | | // FileInputStream is = new FileInputStream("D:\\Pictures\\3.mp4"); |
| | | // byte[] b = new byte[3]; |
| | | // is.read(b, 0, b.length); |
| | | // String photo = bytesToHexString(b); |
| | | // photo = photo.toUpperCase(); |
| | | // System.out.println("头文件是:" + photo); |
| | | // String ooo = TypeDict.checkFileType(photo); |
| | | // System.out.println("后缀名是:" + ooo); |
| | | // } |
| | | } |