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 9231777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:09:15+00:00 2026-06-18T06:09:15+00:00

As a disclaimer, I’ve already seen this post and the posts linking to it.

  • 0

As a disclaimer, I’ve already seen this post and the posts linking to it.

I have a file hosted on a server that is n archived file and I am trying to unarchive it using this method. When the file is pre-downloaded to the device and I open and unarchive it in my application, through an intent-filter from Downloads, there isn’t any problem. However, when I download it from the server within my application, then try to unzip it, I get the error in the title on this line:

ZipFile zipfile = new ZipFile(archive);

Where archive is a File pointing to the archive file I downloaded. The code I’m using to download the archive is as follows:

    String urlPath = parameters[0], localPath = parameters[1];

    try
    {
        URL url = new URL(urlPath);
        URLConnection connection = url.openConnection();
        connection.addRequestProperty("Accept-Encoding", "gzip");
        connection.connect();

        int fileLength = connection.getContentLength();

        InputStream input = new BufferedInputStream(url.openStream());
        OutputStream output = new BufferedOutputStream(new FileOutputStream(localPath));

        byte data[] = new byte[1024];
        long total = 0;
        int count;

        while((count = input.read(data)) != -1)
        {
            total += count;
            publishProgress((int)total * 100 / fileLength);
            output.write(data);
        }

        output.flush();
        output.close();
        input.close();

I’ve recently added the encoding type as-per the post I referenced at the top, but I am still getting the same error. Any help would be great.

Just to clarify:

  • I have an archive file
  • It unarchives fine when the file was downloaded externally and opened/unarchived inside my app
  • When I download the archive and then try to unarchive it, I receive the error java.util.zip.ZipException: Central Directory Entry not found

My best guess is that this is a problem with my download. However, that being said, I don’t know what I’m doing wrong.

  • 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-18T06:09:17+00:00Added an answer on June 18, 2026 at 6:09 am

    You aren’t copying the download correctly. You must use

    output.write(data, 0, count);
    

    Otherwise you are writing arbitrary junk into the file.

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

Sidebar

Related Questions

Disclaimer : I have seen the exact questions, but have not seen any answers
(Disclaimer: New to Rails here) Say I have a Rails ActiveRecord Model that responds
Disclaimer: The author of this post has only theoretical and almost no practical knowledge
Disclaimer: I am not a C programmer. I have recently seen a friend's project.
DISCLAIMER: While I'm trying to do this to fool a license enforcement scheme, the
Disclaimer: this question may not have practical value, it's more of a puzzle/curiosity question.
Disclaimer: This is a homework problem. As should be evident, I am trying to
Disclaimer: the following is a sin against XML. That's why I'm trying to change
Disclaimer: I have attempted to contact the developer about this plugin, but silence reigns.
Disclaimer : this is a strange issue that only happens in a Kindle Fire

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.