My servlet reads the data (in bytes) from a file....I want to download this data onto the clients browser. How can I do this??
Code so far:
-----------
File f = new File(FileName);
try {
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
line = dis.read(b);
while(!done) {
line = dis.read(b);
System.out.write(b);
}
if (line == -1) done = true;
dis.close();
followed by catch statements.
Code so far:
-----------
File f = new File(FileName);
try {
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
line = dis.read(b);
while(!done) {
line = dis.read(b);
System.out.write(b);
}
if (line == -1) done = true;
dis.close();
followed by catch statements.