检测是否jpg代码: public static boolean isJpg(File file) throws IOException { try (InputStream is = new FileInputStream(file)) { ImageInputStream iis = ImageIO.createImageInputStream(is); Iterator<ImageReader> readers = ImageIO.getImageReaders(iis); if (!reader…