wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes Download a file from a https: website Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Download a file from a https: website" Watch "Download a file from a https: website" New topic

Download a file from a https: website

Quang Pham
Ranch Hand

Joined: Nov 29, 2005
Posts: 47
Can some one show me how to write a java program to download a file from a secure server https?
Currently I am able to download file from http but got certificate issue when trying to download from https.
Here is the code:
public static void main(String args[]) throws IOException {
java.io.BufferedInputStream in =
new java.io.BufferedInputStream(
new java
java.io.FileOutputStream fos =new java.io.FileOutputStream("c:/bankInfo.txt");
java.io.BufferedOutputStream bout = new BufferedOutputStream(fos, 1024);
byte[] data = new byte[1024];
int x = 0;
while ((x = in.read(data, 0, 1024)) >= 0) {
bout.write(data, 0, x);
System.out.println("File Downloaded");
I agree. Here's the link: http://aspose.com/file-tools
subject: Download a file from a https: website