OutputStream imgOutputStream = response.getOutputStream();
output = new BufferedOutputStream(imgOutputStream);// 输出缓冲流
byte data1[] = new byte[1024*1024*10];// 缓冲字节数 8K
BufferedInputStream input1 = null;
File file=new File(Timing+"A.zip");
FileInputStream fos=new FileInputStream(file);
input = new BufferedInputStream(fos);// 输入缓冲流
int length = input1.read(data1);
for (int length1 = 0; (length1 = input1.read(data1)) > 0;) {
output.write(data1, 0, length1);
}
output.flush();
output.close();
这个代码里,那个file文件就是A.ZIP,可是传过去是空的,我该怎么样将zip文件转为byte数组呢
读入时使用ByteArrayOutputStream缓存,然后转成byte[]
import java.io.*;