inputstream是不可能转换成outputstream地,我想你问的应该是将inputstream内容写入到outputstream中吧?
下面给你一个示范:
byte[] buffer=new byte[500];
int count=0;
count = input.read(buffer);
while(count>0){
out.write(buffer,0,count);
count = input.read(buffer);
}
下面给你一个示范:
byte[] buffer=new byte[500];
int count=0;
count = input.read(buffer);
while(count>0){
out.write(buffer,0,count);
count = input.read(buffer);
}
try {
response.setHeader("Content-disposition", "attachment;filename=\"" + FileName + "\"");
response.setContentType("application/x-msdownload");
int j = 0; while ((j = in.read()) != -1) {
out.write(j);
}
out.close();
} catch (IOException e) {
e.printStackTrace();
}