Help! Extra one line space in text file?

halo, i am doing a program to download a created text file into pc... the download program is just retrieve records from database and write it into a text file... then i will pass that created text file name to another program, then it will prompt out the window message dialog box to allow user to save or to open the text file....

now i want to know what will cause one extra line at the top of the downloaded text file?

Here is my coding, assume the file name is file1...

response.setContentType("text");

response.setHeader("Content-Disposition","attachment;filename=" + file2);

int Read1;FileInputStream stream1 = null;try {File f = new File("c:/mysql/data/mrs/download/" + file2);

stream1 = new FileInputStream(f);while ((Read1 = stream1.read()) != -1){out.write(Read1);}//end whileout.flush();}//end try

finally {

if (stream1 == null){

stream1.close();

}//end if

}//end finally

[959 byte] By [Takeshi8216a] at [2007-9-23]
# 1

response.setContentType("application/text");

response.setHeader("Content-Disposition","attachment; filename=\"" +fileName);

response.setContentLength((int)file.length());

OutputStream outputStream = response.getOutputStream();

FileInputStream stream = new FileInputStream(file);

BufferedInputStream bufferedInputStream = new BufferedInputStream(stream);

InputStream inputStream = new BufferedInputStream(bufferedInputStream);

int count;

byte buf[] = new byte[4096];

while ((count = inputStream.read(buf)) > -1)

outputStream.write(buf, 0, count);

inputStream.close();

outputStream.close();

nanzeea at 2007-7-10 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2

Sorry I forgot... but before the code i gave kindly insert the File. In your case

File file = new File("c:/mysql/data/mrs/download/" + file2);

String fileName = file.getName();

....remaining previous posted code here...

nanzeea at 2007-7-10 > top of java,Enterprise & Remote Computing,Web Tier APIs...