response.setContentType("application/octet-stream");
//... 중간생략 //... 중간생략
byte[] bytestream = new byte[(int)file.length()]; filestream = new FileInputStream(file);
int i = 0, j = 0; while((i = filestream.read()) != -1) { bytestream[j] = (byte)i; j++; } outStream = response.getOutputStream(); outStream.write(bytestream); |