{note:title=Ugly code alert}
{code}
OutputStream outputStream = response.getOutputStream();
FileInputStream fileInputStream = new FileInputStream(file);
// Copy the contents of the file to the output stream
byte[] buffer = new byte[1024];
int count = 0;
while ((count = fileInputStream.read(buffer)) >= 0) {
outputStream.write(buffer, 0, count);
}
outputStream.flush();
{code}
{code}
OutputStream outputStream = response.getOutputStream();
FileInputStream fileInputStream = new FileInputStream(file);
// Copy the contents of the file to the output stream
byte[] buffer = new byte[1024];
int count = 0;
while ((count = fileInputStream.read(buffer)) >= 0) {
outputStream.write(buffer, 0, count);
}
outputStream.flush();
{code}