Low speed downloading when uses URL class.

In normal downloading(such as "right click -> save as" in ie), my connection speed can reach up to 1.8MBytes/s, but when I use URL to download a file, the speed is obviously lower than the normal one, each read procedure gets 4KBytes ~ 5KBytes
pseudo code here:
URL url = new URL("...");
URLConnection conn = url.openConnection();
conn.connect();
BufferedInputStream bis = new BufferedInputStream(conn.getInputStream(), 1024*1024);
while ((len = bis.read(buf, 0, buf.length)) > 0) {
System.out.println(len);
}

sorry for my mistake.
the above pseudo code is the logical outline of my method, here is my code, thx for helping me :)
     public void doDownload() {
          System.out.println("Download started...");
          try {
               URL url = new URL(vdLink);
               URLConnection connection = url.openConnection();
               int len, sum = 0;
               byte[] buf = new byte[DOWNLOAD_BUFFER_SIZE];
               connection.connect();
               System.out.println("File size: " + connection.getContentLength() + " bytes.");
               BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream( appDir + downloadDir + "\\" + vdFileName), DOWNLOAD_BUFFER_SIZE);
               BufferedInputStream bis = new BufferedInputStream(connection.getInputStream(), DOWNLOAD_BUFFER_SIZE);
               while ((len = bis.read(buf, 0, buf.length)) > 0) {
                    bos.write(buf, 0, len);
                    sum += len;
                    System.out.println(len/1024 + " Kbytes has been downloaded.");
               bis.close();
               bos.close();
          }catch (MalformedURLException urlExcept) {
               urlExcept.printStackTrace();
          }catch (IOException ioe) {
               ioe.printStackTrace();
          System.out.println("Download finished.");
     }

Similar Messages

  • USB Mouse:usb 2-2: new low speed USB device using uhci_hcd and address

    usb 2-2: new low speed USB device using uhci_hcd and address 2
    usb 2-2: new low speed USB device using uhci_hcd and address 2
    usb 2-2: new low speed USB device using uhci_hcd and address 2
    usb 2-2: new low speed USB device using uhci_hcd and address 2
    usb 2-2: new low speed USB device using uhci_hcd and address 2
    usb 2-2: new low speed USB device using uhci_hcd and address 2
    usb 2-2: new low speed USB device using uhci_hcd and address 2
    usb 2-2: new low speed USB device using uhci_hcd and address 2
    usb 2-2: new low speed USB device using uhci_hcd and address 2
    again , again...
    My mouse not working.
    Please help me.Thank you.

    I have same problem. The command "lspci" return for audio card:
    00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
    When "modprobe oss_hdaudio" system freeze.

  • How to monitor Data downloaded, bandwidth used, Url hit in Client machine through SCOM

    Hi,
    Is there is any way which can monitor Data downloaded, bandwidth used, Url hit in Client machine(windows 7 and Windows 8.1) through SCOM.

    adawson wrote:
    Hi,
    I installed and running ebusiness suite 12.1.1 in Oracle Linux server 6.3, below is the url I used to run ebs in the Linux Server,
    http://aserver.localdomain:8000/OA_HTML/AppsLogin
    Can you access this URL on the server itself? Do you see the login page on the server?
    I need to access the ebs from my laptop which is having windows 7 operating system.
    My laptop (with IP Address 10.0.0.4) is connected to network and I can ping with my linux server's IP Address- 10.0.0.2 (ping 10.0.0.2 works)
    but when I ping from my laptop with the server 's hostname ( ping aserver.localdomain) it says "ping request could not find host aserver.localdomain" .What if you access http://10.0.0.2/OA_HTML/AppsLogin from the client, can you see the main login page then?
    when I tried to access the url "http://aserver.localdomain:8000/OA_HTML/AppsLogin" from the laptop ebs page is not opening.
    Please post the contents of the hosts file on the server and the client.
    Is there any configuration to be made in Linux server where ebs is installed or tell me what things to be done to access ebs from another system.Just make sure the firewall is disabled on the Linux server.
    I also have static ip configured in my router, So tell me what settings to be made to access this same ebs through internet.You do not need an internet access here since your server and client on the same network.
    Thanks,
    Hussein

  • Error Message When Using a Class Files to Control Navigation

    This is my first attempt at using a class file in a flash project. My intent is to keep all of my navigation elements in class file called "Navigation".  However, I keep getting an error message when I publish.
    I am using a button to go back to the main screen and I gave that button the instance name of "bnt_home". I have also linked that button in the library to the class "Navigation".
    Here is the code:
    package
        import flash.display.SimpleButton;
        public class Navigation extends SimpleButton
            public function Navigation()
                bnt_home.addEventListener(MouseEvent.MOUSE_DOWN, goNavigation);
            private function goNavigation(event:MouseEvent):void
                gotoAndPlay(1,"Main");

    When I changed the code I got error (1046: Type was not found or was not a compile-time constant: MouseEvent).
    package
        import flash.display.SimpleButton;
        public class Navigation extends SimpleButton
            public function Navigation()
                this.addEventListener(MouseEvent.MOUSE_DOWN, goNavigation);
            private function goNavigation(event:MouseEvent):void
                root.gotoAndPlay(1,"Main");

  • Problem when used InetAddress class in Applet

    Hi all.
    I'DongPG from Vietnam.
    I have a question'How to get IP that different from IP default "127.0.0.1" address'.
    I've built an applet where i used InetAddress class to get browser'IP follow:
    InetAddress localIP = InetAddress.getLocalHost();
    String strIP=localIP.getHostAddress();
    I used JBuilder to build applet. It's gotten IP right. Ex:strIP='192.168.100.1'
    But when i used browser link to my Applet in WebServer, it only return strIP='127.0.0.1'
    Thank a lot!

    Wrong forum and cross posted as well.

  • Avoiding attributes when using transform class

    Hi,
    One more help pls!!!!!
    When I use transform class and create an XML file, it creates with attributes for the nodes.
    For exapmle,
    <MessageOwner type="type" name="name">
    How do I avoid this type and name attributes?????
    Thanx and Regards,
    Gayathri.

    create a XSL that will not output the attibutes.

  • Passing argument to, when using one class for multiple assets

    I had a class that I was passing a simple argument to like so:
    var quiz_1_2:CaseStudyQuiz = new CaseStudyQuiz(2);
    addChild(quiz_1_2);
    I now would like to use this class for multiple MCs in my library. I thought I could let Flash create a class for each of them and specifying the CaseStudyQuiz class as the Base class. When I do that, I get the following error:
    1136: Incorrect number of arguments.  Expected 0.
    Obviously this is because the class created by flash does not except an argument. Does that mean, I would have to create a seperate class for each of the movies that use that class? And if so, what would I have to do in that class for it to except the parameter and pass it on to my base class?
    Thank you very much for any help with this!!!

    use the super() function and pass your parameter.  but you still might get a runtime error but i don't think that will cause a problem.

  • Why offer download, when no URL supplied?

    I was just doing a few quick checks based
    on the previous thread by Baski (sorry, I have
    no new/interesting information to offer on that
    specific question), and noticed a disturbing
    thing.
    Here is a series of three images (total
    <100Kb) that demonstrate the experience
    the user sees if they have insufficient Java
    to run the application, but no download
    URL is supplied in the J2SE element.
    http://www.physci.org/jws/upgrade.html
    The first image shows a dialog which asks
    "Do you want this JRE to be downloaded
    and installed?"
    If the user clicks 'OK', not only does the
    the launch fail with the vague message
    "Unable to launch the application",
    but it requires clicking the Details button,
    selecting the Console tab, and scrolling
    to the bottom of the output before they
    can finally see the descriptive message
    "#### The application has requested a
    version of the JRE (version 1.8+) that
    currently is not locally installed. Java
    Web Start is unable to automatically
    download and install the requested
    version. This JRE must be installed
    manually."
    JWS should provide that message initially,
    centered in a dialog, instead of prompting for
    download, then hiding the message in the
    console.
    To put that another way..
    Why even offer the JRE download, when no
    download URL is supplied?

    Thank you.
    I might create a new example now, this time
    with a download URL (but I would need to
    uninstall 1.6, in order to get screenshots
    of an install).
    What was that about still no 1.6 auto-dl?
    I'll have to wait a bit, I suppose..

  • Can get lower case letters when using bios

    I purchased a used macbook air.  Changed the user to me but never changed the old user password.  I recently autorize an update and I can't get in without a password.  I never changed the old user password and newer assigned a password to my name.  Now I can't get in.  I tried going to the bios but I only cant type upper case letters and no lower case letters.  Can someone help me as to how I can type lower case letters when I start the bios?

    Unfortunately this is often the case, particularly if the field is not properly identified as a password field, and is true for both Web pages as well as (poorly designed) BlackBery applications.
    I've just gotten into the habit of typing the first letter of my password, then hitting the [Del] key, then typing in my full password all the time!
    Jerry

  • Compile error when using a class by fully-qualified name

    Hi... Is it an AS3 "feature" or a FB compiler bug that I cannot use a class without importing it?
    I have a statement such as
    if (de.codebank.util.StringUtilities.startsWith(status.name, phase.name+"_"))
    which does not compile until I import the StringUtilities class, which is pointless, of course.
    The compile error mentions an unknown property "util"

    I believe this is how AS3 works. Fully qualified class types require import statement.
    You use fully qualified name whenever you want to avoid ambiguity.
    However, when the code is like,
    import mx.collections.XMLListCollection;
    var arr:mx.collections.ArrayCollection;
    It works since compiler now understands that "mx.collections" is a package.

  • Low speed download

    I bought a macbook pro retina 13 few weeks back, every thing was ok till I realise the very bad speed download.
    I have an 8 Mb speed internet connection and I'm usually using wifi, with my old PC win 7 I'm reaching easly 1 Mb/s of speed download.
    with my new macbook pro I'm surprised to have juste 300 kb/s and dropping till reaching 60 to 70 kb/s.
    this problem was reported by several personnes, and as I understand the problem is with mountain lion version, and no real solution is available to fix it.
    and the solution remain with apple, then any plan to fix it? any update scheduled?
    spending 1700 USD for a laptope to continue using my old win7 PC for downloading???

    oldink76,
    if your MacBook Pro’s connection to your router is over wi-fi rather than over wired Ethernet, then it’s not surprising that elevating its antenna (which is behind the display) could help. Enjoy the speed!

  • Workers throw security error when using File class

    I am creating a program that is writing/reading large files using the FileStream class. This portion works fine but when I want to use concurrency to prevent the UI from locking it fails.  When I check inside Adobe Scout I can see the worker fires a secuirty error.
    SecurityError: file
        at flash.filesystem::File$/getFile()
        at flash.filesystem::File$/get userDirectory()
        at Main/archiveFile()
        at Main/onMessageToArchiveWorker()

    Could you please open a new bug report on this over at bugbase.adobe.com?  When adding the bug, please include sample code or an application so we can quickly test this out internally.  If you'd like to keep this private, feel free to email the attachment to me directly ([email protected]). 
    Once added, please post back with the URL and I'll follow up internally.
    Thanks,
    Chris

  • Speed issue when using Airport Express

    Hello.
    I have had an ongoing battle recently with Internet download speeds.
    I connect my iMac to my Airport Express.
    iMac has Firewall ON.
    When I connect this way, I get slow connection / download speeds.
    The file I am using in this example is the MS Office 2003 SP3 update.
    I get around 200kbps.
    However....
    When I connect my iMac directly via Ethernet to my Cable Modem, I am getting 1.5mbps download.
    Can anyone shed any light on this and advise how I can correctly configure the Airport to get nearer this speed?
    Many thank in advance
    Glenn

    Have you repaired Permissions since the last update/upgrade?
    If not, either do that or get Applejack...
    http://www.versiontracker.com/dyn/moreinfo/macosx/19596
    After installing, reboot holding down CMD+s, then when the prompt shows, type in...
    applejack AUTO
    Then let it do all 5 of it's things.
    At least it'll eliminate some questions if it doesn't fix it.
    The 5 things it does are...
    Correct any Disk problems.
    Repair Permissions.
    Clear out Cache Files.
    Repair/check several plist files.
    Dump the VM files for a fresh start
    While watching Activity Monitor>Networks, are there dips in the download speed, or just flat slow input?
    How many bars do you get?
    What speed does it say it's connecting at in Network Utility?

  • Slow downloads when using Time Capsule

    When I connect directly to my modem, I can get speed up to 30Mbps.  When I plug my modem into my Time Capsule, my download speeds go way down to under 7Mbps.  Is there any way to increase my speed?

    The TC is  model number A1254 and is at least 3 years old.  i honestly can't remember when I bought it, but it may just be old.
    Yes, that is the Gen1 TC and is old. We have found they get unreliable even if the power supply keeps going after about 3years.
    Anyway.. do some tests..
    1. Factory reset the TC. If you haven't done it already it is worth taking it back to scratch.
    2. Force the speed of the WAN port to 100mbps.
    Your current speed is below the 10mbps everything goes to when things go bad. So check the ethernet cable is good. When you setup WAN, there is option to set the WAN speed. (It is probably missing in v6 airport utility of course).
    3. Check the ethernet cables are good just use them between LAN port of the TC and Mac..
    4. Apple keep trying to update everything all the time but IMO v7.6.1 firmware on the old TC may not be the best.. hold down the option key when you update firmware to choose 7.5.2 firmware and see how that goes.
    But you could just be up for a replacement. If you do get another TC make sure you get it on 7day return as the issue could happen again even with the latest one.
    Use v5 utility. In your profile you are using Lion.. just download and install it.
    http://support.apple.com/kb/DL1482

  • How to get the log information when using a class?

    Hi All,
    I have a simple question, which I don't know how to solve. I am using org.apache.commons.logging.Log and LogFactory to do some logging. A typical situation is exemplified in the following code snippet.
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    class LogClass {
        private static final Log LOG = LogFactory.getLog(AClass.class);
        public void logit(){
            LOG.debug("This is the debugging log.");
    public class AClass{
        public static void main(String[] args) {
            LogClass l=new LogClass();
            l.logit();
    }But this way, I do not get the log information from the class LogClass. Could anybody please help?
    Many thanks.

    jschell wrote:
    jverd wrote:
    ...configuration in log4j.xml or log4j.properties.And far as I recall you need one of those two also. If there is no config then there is no output.I thought it used some default config if no file is present, but I could be mistaken. Either way, it adds to the possible problems that the OP could be having, any of which are consistent with his rather vague question.
    1) He's passing the wrong class to the LogFactory, and hence getting a logger with the wrong name, so he's seeing a different name than he expects in the output that's being produced.
    2) His config file does not contain the proper format to include the actual classname, independent of the logger's name, so he's missing a piece of desired information in each line of the output that's being produced.
    3) His config file indicates a threshold that's less verbose than the level at which his code is logging, so no output is present when he wants it.
    4) His config file is missing (or not where it's expected to be), so no output is being produced at all.
    5) His config file is missing (or not where it's expected to be), so a default level or format is being produced, effectively the equivalent of one of the misconfigurations described in #2 and #3.
    Since the OP seems to have vanished, we may never know.

Maybe you are looking for