Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9272583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:54:24+00:00 2026-06-18T15:54:24+00:00

I want to download a binary file from a webserver which is running on

  • 0

I want to download a binary file from a webserver which is running on a embedded device. That file can be downloaded manually after a basic http authentication by using that
URL: http://10.10.10.10/config.bin… Now i want to automate this process with a simple Java application. By using the basic java tools i managed to download the file:

URL mlrrl = new URL(url);
            HttpURLConnection  con = (HttpURLConnection) mlrUrl.openConnection();

            con.setRequestMethod("GET");
            con.setAllowUserInteraction(false);
            con.setDoInput(true);
            con.setDoOutput(true);
            con.setConnectTimeout(10000);
            con.setRequestProperty("Authorization", "Basic " + authStringEnc);

            InputStream stream = con.getInputStream();
            BufferedInputStream in = new BufferedInputStream(stream);
            FileOutputStream file = new FileOutputStream("configDown.bin");
            BufferedOutputStream out = new BufferedOutputStream(file);
            int i;
            while ((i = in.read()) != -1) {
                out.write(i);
            }
            out.flush();

That seemed to work fine! In comparison with the manually (by Browser-Webinterface) downloaded file the generated file have the same length, but after opening both binaries with a hex-editor they were different.

My questions:

  1. Any ideas why the hex-codes are different? (Maybe missing connection properties?)
  2. There is a copyUrlToFile-Method in the apache.commons package. Is it possible to use it with basic http authentification, as a alternative?
  3. Are there other java libs or tools for downloading files from urls?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:54:25+00:00Added an answer on June 18, 2026 at 3:54 pm

    I can´t explain why, but the faulty property “setDoOutput” = “true” maybe influenced the content of the downloaded file. Setting the value to “false” solved that issue for me!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to download a binary file from a url. Is it possible to
I want to download a single frame of a video file from a server
Okay, we have a PHP script that creates an download link from a file
I would like to write a binary file from a netcdf file library(ncdf) download.file(http://gswp/Fixed/SoilDepth.nc,
I have a website from which I want to enable browser users to download
I have a simple HTML file which references .gadget so that it can be
If you want to ensure that a file is valid (untampered and came from
I want to do an ASCII text download of user-selected SQL data, that can
what I want: Download a webpage from a server > Save content in a
I want to download a video from the internet in my application. Hence, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.