/**
* 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" , "具体文件名"));
最后
以上就是傻傻皮卡丘最近收集整理的关于byte[] 转 file的全部内容,更多相关byte[]内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复