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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:39:06+00:00 2026-06-05T15:39:06+00:00

I am working on a blackberry app in which I got a pdf-url from

  • 0

I am working on a blackberry app in which I got a pdf-url from web-service. I need to use that url to download that PDF and save that to my SD card.

Please let me know, is it possible or not.

  • 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-05T15:39:07+00:00Added an answer on June 5, 2026 at 3:39 pm

    I apologies to reply very late, I got success in this task. I know this was a not a “much effort task” but this was lesson for me. I used the following Thread code for this task.

    private class DownloadCombiner extends Thread {
            private String remoteName;
            private String localName;
            private int connection;
            private int chunksize;
            public DownloadCombiner(String remoteName, 
                    String localName, int connection, int chunksize) {
                this.remoteName = remoteName;
                this.localName = localName;
                this.connection = connection;
                this.chunksize = chunksize;
            }
            public void run() {
                try {
                    int chunkIndex = 0;
                    int totalSize = 0;
                    /*
                     * File connection
                     */
                     FileConnection file =(FileConnection)Connector.open(localName);
                     if (!file.exists()) {
                         file.create();
                     }
                     file.setWritable(true);
                     OutputStream out = file.openOutputStream();
                     /*
                      * HTTP Connections
                      */
                     String currentFile = remoteName + connectionType();
                     //log("Full URL: " + currentFile);
                     HttpConnection conn;
                     InputStream in;
                     int rangeStart = 0;
                     int rangeEnd = 0;
                     while (true) {
                         //  log("Opening Chunk: " + chunkIndex);
                         conn = (HttpConnection) Connector.open(currentFile, 
                                 Connector.READ_WRITE, true);
                         rangeStart = chunkIndex * chunksize;
                         rangeEnd = rangeStart + chunksize - 1;
                         // log("Requesting Range: " + rangeStart + 
                         //      "-" + rangeEnd);
                         conn.setRequestProperty("Range", "bytes=" +
                                 rangeStart + "-" + rangeEnd);
                         int responseCode = conn.getResponseCode();
                         if (responseCode != 200 && responseCode != 206)
                         {
                             // log("Response Code = " + conn.getResponseCode());
                             break;
                         }
                         // log("Retreived Range: " + conn.getHeaderField("Content-Range"));
                         in = conn.openInputStream();
                         int length = -1;
                         byte[] readBlock = new byte[256];
                         int fileSize = 0;
                         while ((length = in.read(readBlock)) != -1) {
                             out.write(readBlock, 0, length);
                             fileSize += length;
                             Thread.yield(); // Try not to get cut off
                         }
                         totalSize += fileSize;
                         // log("Chunk Downloaded: " + fileSize + " Bytes");
                         chunkIndex++; // index (range) increase
                         in.close();
                         conn.close();
                         in = null;
                         conn = null;
                         /*
                          * Pause to allow connections to close and other Threads
                          * to run.
                          */
                         Thread.sleep(1000);
                     }
                     // log("Full file downloaded: " + totalSize + " Bytes");
                     out.close();
                     file.close();
                     // log("Wrote file to local storage");
                } catch (Exception e) {
                    System.out.println(e.toString());
                }
            }
            private String connectionType() {
                switch (connection) {
                case 1:
                    return ";deviceside=false";
                case 2:
                    return ";deviceside=true;interface=wifi";
                default:
                    return ";deviceside=true";
                }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a BlackBerry application that consumes web services from ColdFusion
I have a simple BlackBerry app i'm working on that uses JSONP and Zepto.js.
I am currently working on a blackberry app that needs to connect to facebook
I'm working on a BlackBerry WebWorks app that connects to the Blackberry Messenger Platform.
I am working on blackberry project where i want to download image & save
Details: I'm working on a BlackBerry app, and one of the features is signature
I'm in lean startup mode, working on a simple phone app that will be
Currently i am working on Blackberry Application and stuck at this point that how
I'm working on a Blackberry application (JDE 4.6.1) on a Windows system. I need
I am trying to develop a BlackBerry application that will show data from an

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.