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

  • SEARCH
  • Home
  • 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 6938599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:30:49+00:00 2026-05-27T12:30:49+00:00

I m download a zip in android and got following errors. InputStream Connection is

  • 0

I m download a zip in android and got following errors.

InputStream Connection is null exception thrown is

java.net.MalformedURLException: Protocol not found: www.songspk320.in/128/indian/Don-2-2011-128Kbps(Songs.PK).zip
    at java.net.URL.<init>(URL.java:273)
    at java.net.URL.<init>(URL.java:157)
    at com.linkezzi.web.DownloadIconSetZIP.openInputStreamConnection(DownloadIconSetZIP.java:73)
    at com.linkezzi.web.DownloadIconSetZIP.doInBackground(DownloadIconSetZIP.java:45)
    at android.os.AsyncTask$2.call(AsyncTask.java:185)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
    at java.lang.Thread.run(Thread.java:1019)

Code is Given Below.

public class DownloadIconSetZIP extends AsyncTask {

        private File root  = null;
        private String url = null;
        private File pathToLinkEziiIconSetRootFolder = null;
        private File toBeExtracted = null;
        private FileOutputStream fOut  = null;
        private Context mContext = null;
        private InputStream input  = null;


        public DownloadIconSetZIP(Context mContext,String uriZIP){

            this.url = uriZIP;
            this.mContext = mContext;
        }
        protected Object doInBackground(Object[] params) {

            if(this.url != null){

                root = Environment.getExternalStorageDirectory();

                try {

                    Log.e("Downloading Iconset in BackGround","URl = "+ url);

                    openInputStreamConnection();

                    Log.e("Iconset is Downloading from the URI  = ",url.toUpperCase());

                    pathSetInLocalFileSystem();

                    downloadFile(input);


                }catch(MalformedURLException malformedURLException){

                    malformedURLException.printStackTrace();

                }catch (Exception e) {

                    e.printStackTrace();

                }

            }

            return null;
        }
        private void openInputStreamConnection() throws IOException,
                MalformedURLException {


            try {
                HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
//              conn.setDoInput(true);
                conn.setConnectTimeout(30000); // timeout 10 secs
                conn.connect();
                input = conn.getInputStream();
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }

        }
        private void downloadFile(InputStream input) throws IOException {
            int byteCount = 0;
            byte[] buffer = new byte[1024];
            int bytesRead = -1;
            while ((bytesRead = input.read(buffer)) != -1) {

                fOut.write(buffer, 0, bytesRead);
                byteCount += bytesRead;

            }
            fOut.flush();
            fOut.close();
        }

        private void pathSetInLocalFileSystem() throws FileNotFoundException {


            pathToLinkEziiIconSetRootFolder = searchFileInThisDirectory(root);

            if(pathToLinkEziiIconSetRootFolder == null){
                pathToLinkEziiIconSetRootFolder = new File(root.getAbsolutePath(),"LinkEziiIconsets");

                if(!pathToLinkEziiIconSetRootFolder.exists() && pathToLinkEziiIconSetRootFolder.mkdir()){
                    Log.e("LinkEzii Iconset Container Folder is Created","LinkEzii Iconset Container Folder is Created");
                }else{
                    Log.e("LinkEzii Iconset Container is Not Created","LinkEzii Iconset Container is Not Created");
                }
            }

            File downloadedIconSetFile = new File(pathToLinkEziiIconSetRootFolder.getAbsolutePath(),"IconSetName Comes Here...");

            if(!downloadedIconSetFile.exists()){
                downloadedIconSetFile.mkdir();
                Log.e("Container is Created for Iconset","Container is Created for iconset");
            }


            if(downloadedIconSetFile!=null){
                toBeExtracted = new File(downloadedIconSetFile, "IconSet Zip Format.zip");
                fOut = new FileOutputStream(toBeExtracted);
            }

        }
        private File searchFileInThisDirectory(File file) throws NullPointerException {

            if(file == null){
                throw new NullPointerException();
            }

            File[] listFiles = file.listFiles();

            File pathToLinkEziiIconSetRootFolder = null;

            for(File searchIT: listFiles){
                if(file.isDirectory() && file.getName().equals("LinkEziiIconsets")){
                    pathToLinkEziiIconSetRootFolder = file;

                    return pathToLinkEziiIconSetRootFolder;
                }
            }

            return pathToLinkEziiIconSetRootFolder;

        }

        protected void onCancelled() {
            super.onCancelled();
            Log.i("Downloading is Cancelled","Download is Cancelled");
        }

        protected void onPostExecute(Object result) {
                super.onPostExecute(result);

//          Decompressing the File
            if(toBeExtracted != null){

//              Just to Move the Decompressing  to the Back Ground Thread
                new Thread(new Runnable() {

                    @Override
                    public void run() {

                        DecompressDownloadedDiagram decompressdDownloadedDiagram = new DecompressDownloadedDiagram(toBeExtracted.getPath(), toBeExtracted.getPath(),toBeExtracted);
                        decompressdDownloadedDiagram.unzip();
                        toBeExtracted.delete();
                    }
                }).start();

             Toast.makeText(mContext, "Icons Set is Successfully Downloaded", Toast.LENGTH_LONG).show();

            }else{
                Toast.makeText(mContext, "Error! while downloading diagram", Toast.LENGTH_LONG).show();
                Log.e("Some Error Occure While Downloading Diagram","Some Error Occure While Downloading Diagram");
            }

            Log.i("Downloading is Successful","Downloading is Successful");
        }

        protected void onPreExecute() {
            super.onPreExecute();
            Log.i("Downloading is Starting","Downloading is Starting");
        }

        protected void onProgressUpdate(Object[] values) {
            super.onProgressUpdate(values);

            Log.i("Downlaoding is in Progress","Downloading is in Progress");
        }


    }
  • 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-05-27T12:30:50+00:00Added an answer on May 27, 2026 at 12:30 pm

    MalformedURLException generally thrown when there is no protocol attached with the system you have to check whether any protocol is that by checking whether :// is present in your URL string.. If your url is having www you can check it with whole http://.

    Find occurrence of http:// by calling contains() method on your url string. If you can find check whether they are starting characters of string call url.startsWith("http://") to make sure this exception can not be thrown.

    If none of above tests pass just add this line.

    url = "http://"+url;

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

Sidebar

Related Questions

For some reason when I download a zip folder from my server's folder it
I'm using the IdFTP (Indy 10) component to download some files (zip and txt)
I have a download page where there are 3 download options: Word, Zip, and
i download a kml file : <?xml version=1.0 encoding=UTF-8?> <kml xmlns=http://www.opengis.net/kml/2.2> <Document> <Style id=transGreenPoly>
I'm developing an Android game that has to download some assets to the SD
I am trying to download a zip file using HttpCLient 4 and it is
I wanna use php to download some zip files from a url. I.E. sitename.com/path/to/file/id/123
I need to download a zip archive of text files, dispatch each text file
I'm using python to programatically download a zip file from a web server. Using
I'm trying to use the following code to create a zip file from a

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.