文件与byte[]的相互转换

it2025-12-19  5

文件、文件流、byte数组

将byte数组生成文件保存至本地

byte[] bytes = []; //... //------获取byte数组的过程 //... FileOutputStream outputStream = new FileOutputStream(new File("d://mergeSheet12.xls")); outputStream.write(bytes); outputStream.close();

将本地文件转化为byte数组

File file = new File("d://mergeSheet.xlsx"); InputStream input = new FileInputStream(file); byte[] bytes = new byte[input.available()]; input.read(bytes);
最新回复(0)