/** * byte[] 转 file * @param bytes * @param path * @return * @see [类、类#方法、类#成员] */ public static void byteToFile(byte[] bytes, String path) { try { // 根据绝对路径初始化文件 File localFile = new File(path); if (!localFile.exists()) { localFile.createNewFile(); } // 输出流 OutputStream os = new FileOutputStream(localFile); os.write(bytes); os.close(); } catch (Exception e) { e.printStackTrace(); } }
byteToFile(content , String.format("D:/%s" , "具体文件名"));