473,471 Members | 2,062 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

In Java Corrupted Excel file

1 New Member
Hello,


Language= Java;
Platform= Linux;
Application= Web

I have help excel file. I download it using FileInputStream.
When it is downloaded from solaris or widows platform it is correct.
But when it is downloaded from Linum platform it becomes corrupted.

Expand|Select|Wrap|Line Numbers
  1.  
  2. PrintWriter out = new PrintWriter(response.getOutputStream());
  3. response.setContentType("application/excel");
  4. response.setHeader("Content-Disposition", "attachment; filename=\a.xls\");
  5. //Sending the file
  6.     int iRead;
  7.     FileInputStream stream = null;
  8.     File f = new File("a.xls");
  9.     stream = new FileInputStream(f);
  10. //Writing the stream values 
  11.     while ((iRead = stream.read()) != -1)
  12.     out.write(iRead);
  13. //Flush the output
  14.     out.flush();
  15.  
Kindly, provide me solution.
Apr 4 '07 #1
0 1268

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: SubbaRao Karanam | last post by:
What does this error for the Code below java.io.StreamCorruptedException: invalid stream header at java.io.ObjectInputStream.readStreamHeader(Unknown Source) at...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
1
by: Tony Moss | last post by:
I have a small new, simple db in Access 2002 WinXP running on a network (3 users) and vpn Terminal services (2 users). Just 2 tables Clients and sub form / table Purchases. This last week we have...
1
by: Boomessh | last post by:
Hi, I am trying to open an existing excel workbook. It pops up an error stating that “Errors were detected in 1598.xls but Microsoft Office Excel was able to open the file by making the repairs...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
5
by: jeffreywgraham | last post by:
Laptop lost power while on an airplane. No big deal, but the Access database that I was working on at the time now won't open. I've tried to repair it, I always get the error message about the file...
0
by: SuperFly07 | last post by:
Any Java Gurus out there that can help. I need to write a java class which will disable password protection on the Excel file in a folder and we use that file to store data in table. So script must...
2
budigila
by: budigila | last post by:
Hiya peeps, Okies, I have been trying to work this out for a while now to no avail... I am a beginner to this whole coding thing but have made great strides in my project. Basically what I am...
1
ddtpmyra
by: ddtpmyra | last post by:
When Im downloading a file from mysql database the file is already corrupted below are the code I used on downloading to mysql and uploading from mysql. PDF file are doing okay as long as it is a...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.