Video file downlaod into pieces does not

Hello

I have the server and downaload videos. I use this article to get the file video downlaoded

http://supportforums.BlackBerry.com/T5/Java-development/download-large-files-using-the-BlackBerry-mo...

But its not working not not for me because I am unable to calculate the range of bytes excar too ask like piece and stuck in a loop.

            while (true) {
                log("Opening Chunk: " + chunkIndex);

                conn = (HttpConnection) getHttpConnection(currentFile);

                conn.setRequestMethod( HttpConnection.POST );
                conn.setRequestProperty("x-rim-transcode-content", "none");

                rangeStart = chunkIndex * chunksize;
                rangeEnd = rangeStart + chunksize - 1;
                log("Requesting Range: " + rangeStart +  "-" + rangeEnd);
                conn.setRequestProperty("Range", "bytes=" + rangeStart + "-" + rangeEnd);

                log("Http.HEADER_CONTENT_LENGTH" + conn.getHeaderField(HttpProtocolConstants.HEADER_CONTENT_LENGTH));

                int responseCode = conn.getResponseCode();
                if (responseCode != 200 && responseCode != 206)
                {
                    log("Response Code = " + conn.getResponseCode());
                    break;
                }

                in = conn.openInputStream();
                int length = -1;
                byte[] readBlock = new byte[1024];

                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;
            }
            log("Full file downloaded: " + totalSize + " Bytes");
            out.close();
            file.close();
            log("Wrote file to local storage");

Above is the code that I use, with goodness, someone help me on what Miss me

Thanks in advance for your help

I suggested using 64 K, it is 65536 bytes.  Have you tried something around this size.

Can you try this isze and paste in the 10 first lines you get with the applicant range.

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for

  • How to display only icons on the personal bar?

    In the bookmarks toolbar, I have a lot of Favorites and do not want to see titles unless I hover over the icon.Is this possible?I saw a suite called = add (Smart bookmarks Menu"but he said he was abandoned and not put to update to the latest version

  • Skype for Mac 6.9 list problems - unstable

    Here is a list of the problems after the upgrade to 6.9 Skype on my Mac (running on OS X 10.8.5), 8 GB of RAM, Seagate Mementus XT hybrid hard drive. Front of performaing the troubleshooting steps I completely check through various utilities / diagno

  • Satellite A30 needs ACPI for Vista

    I have laptop TOSHIBA Satellite SA30-213. I try to install Windows Vista Beta 2, but it fails and give a message that my bios needs ACPI.How can I update my BIOS? I tried to get an update and I failed.What should I do to install vista?

  • computer cannot communicate with over 8600

    My 8600 Officejet Plus works fine on a wireless network for about a year, but after restarting the computer yesterday morning, I get the message "...". cannot communicate with the printer.  I tried all the suggestions below without result.  I can acc

  • Code 28 base system device

    I just installed an ASMedia XHCI USB 3.0 on my Z800 work card (Pro Windows, 64) and while Device Manager indicates that the new USB controllers and pilots work, I now have an error symbol in the other devices section (in Device Manager) showing a non