Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

API For File Download

 
Jyoti Giri
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me if there exists any api for downloading file from server??

Thanks.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the classes in the package java.net. See these examples.

What protocol are you using? HTTP, FTP or something else? For FTP, see Apache Jakarta Commons Net.
[ November 13, 2007: Message edited by: Jesper Young ]
 
Jyoti Giri
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
I am using HTTP protocol. Actually my file(XLS) is successfully downloaded as an attachment, i can open it,view it . I am using Commons package for parsing it, and is gives exception while parsing.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you gong to tell us what the exception is, and show the code that produces it?
 
Jyoti Giri
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually , am sorry the exception comes when i use JXL package to read the file .

The exception is :
jxl.read.biff.BiffException: Unable to recognize OLE stream

and the code that produces this exception is :

try
{
SrcDir=sRootPathUpload +File.separator +fileName;
loadFile=new File(SrcDir);
workbook = Workbook.getWorkbook(loadFile);
}
catch(Exception e)
{
bFileError=true;
WriteLog1("ERROR In Creating Workbook "+e.toString(),sUploadLog);
}
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the file path get constructed correctly (i.e., is "loadFile.exists()" true)?

Can Excel open the file without problems?
 
Jyoti Giri
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You For your help. My problem is solved.

Cheers!!
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What was the problem?
 
Jyoti Giri
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, after downloading the file , i was using jxl package to get(read) the cell contents, but i used table format to write it on output...so when i tried to upload it again, it was not pure xls file, hence the biff exception.

Now i am using writeble workbook to write.

Thanks for your time and help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic