File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes API For File Download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "API For File Download" Watch "API For File Download" New topic
Author

API For File Download

Jyoti Giri
Greenhorn

Joined: Apr 25, 2007
Posts: 10
Can anyone tell me if there exists any api for downloading file from server??

Thanks.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14338
    
  22

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 ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Jyoti Giri
Greenhorn

Joined: Apr 25, 2007
Posts: 10
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
Marshal

Joined: Mar 22, 2005
Posts: 42591
    
  65
Are you gong to tell us what the exception is, and show the code that produces it?


Ping & DNS - my free Android networking tools app
Jyoti Giri
Greenhorn

Joined: Apr 25, 2007
Posts: 10
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
Marshal

Joined: Mar 22, 2005
Posts: 42591
    
  65
Does the file path get constructed correctly (i.e., is "loadFile.exists()" true)?

Can Excel open the file without problems?
Jyoti Giri
Greenhorn

Joined: Apr 25, 2007
Posts: 10
Thank You For your help. My problem is solved.

Cheers!!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42591
    
  65
What was the problem?
Jyoti Giri
Greenhorn

Joined: Apr 25, 2007
Posts: 10
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: API For File Download