RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 343 | Replies: 0
Reply
Join Date: Sep 2004
Posts: 2
Reputation: TheProfessional is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
TheProfessional TheProfessional is offline Offline
Newbie Poster

Removing unwanted character from end of downloaded file

  #1  
Sep 24th, 2008
I've created a jsp that will download a file for the user when its loaded. When this file is downloaded and opened, the end of the file contains this funny character - ΓΏ

Does any one have any idea how to remove this character or prevent this from happening. Here's a code snippet:

<%
	//Throw the document
	InputStream in = new FileInputStream(uploadDocFile);
	OutputStream ros = response.getOutputStream();
	response.setContentType("application/msword");
	response.setHeader ("Content-Disposition", "attachment;filename="+docFilename);

	int bit = 256;
	int i = 0;


    		try {


        			while ((bit) >= 0) {
        				bit = in.read();
        				ros.write(bit);
			}
        			
            	} catch (IOException ioe) {
            			ioe.printStackTrace(System.out);
            	}



	ros.flush();
	ros.close();
	in.close();

	out.clear();
	out = pageContext.pushBody();
%>
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:01 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC