### Question:
FileTypesDetector { public static String getType(InputStream is) throws IOException { int len = 100; int off = 0; if (is.available() <= 0) { return "Empty File"; } if (is.available() < 100) { len = is.available(); } InputStream inputStream; if (!is.markSupported()) { inputStream = new BufferedInputStream(is); } else { inputStream = is; } inputStream.mark(len); String fileHead; byte[] bytesArr = new byte[len]; int total = inputStream.read(bytesArr, off, len); if (total != -1) { fileHead = bytesToHexString(bytesArr); } else { return null; } if (fileHead == null || fileHead.length() == 0) { return null; } FileType[] fileTypes = FileType.values(); for (FileType type : fileTypes) { if (fileHead.startsWith(type.getValue())) { return type.toString(); } } inputStream.reset(); String txt = isTextFile(inputStream); inputStream.close(); if (txt != null) { return txt; } if (fileHead.startsWith("FFF")) { return "AUDIO_FILE"; } return "DATA"; }  static String getType(InputStream is); static String getType(String filePath); static boolean isAPK(InputStream inputStream); static boolean isAPK(File pFile); static boolean isSIS(File pFile); static boolean isDEX(File pFile);  }### Answer:
@Test public void testGetType() throws Exception { String path = "/home/lai/Work/svn/08个人目录/lyb/malware_analysised/a.payment.PCSuitUpdate/a.payment.PCSuitUpdate.b/a.payment.PCSuitUpdate.b_001.apk"; System.out.println("文件类型 " + FileTypesDetector.getType(path)); System.out.println("是否APK " + FileTypesDetector.isAPK(new File(path))); System.out.println("====================="); }