aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes HTTPS File download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "HTTPS File download" Watch "HTTPS File download" New topic
Author

HTTPS File download

Dylan Margoczi
Ranch Hand

Joined: Jul 12, 2007
Posts: 38
Hi there.

I need to download files through my program from an https site.
I've done this through ftp. But can't see how it's done through https.
Can it be done? How?

Thanks in advance.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41888
    
  63
Have a look at this example. It creates a Reader from the InputStream -which wouldn't be appropriate for a binary file- but otherwise it's just what you're asking for.


Ping & DNS - my free Android networking tools app
Dylan Margoczi
Ranch Hand

Joined: Jul 12, 2007
Posts: 38
Thanks Ulf.

It's returning data. The only problem is it's not returning the correct data.
I think it has something to do with the encoding but i cant seem to fix the problem.
Here's the file I'm trying to get.

https://commerce.sars.gov.za/mas_static/code_tables/CARGOCARRIER.csv

any help appreciated.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41888
    
  63
There shouldn't be any encoding issues if you save the bytes you receive from the InputStream directly into a file. Encodings only enter the picture once the bytes are converted into characters.

Open the saved file in a text editor, and try out various encodings to see which one might be correct.
Dylan Margoczi
Ranch Hand

Joined: Jul 12, 2007
Posts: 38
It comes up as "Unicode" in EmEditor. but when I try read it using "Unicode" in the program it still doesn't come out right.

I need to convert it to characters in order to work with it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTPS File download