If in the URLconnection I setUseCaches(true), I must to wait until...

Hello, sorry for my english and thanks for all.
I know how can to use an URLconnection for to get the file size for download and after to get the InputStream read it and to get the progress download.
If in the URLconnection I setUseCaches(true), I must to wait until the file is all download an after I can read the InputStream.
If in the URLconnection I setUseCaches(false), I can read the InputStream at the same time that the file is downloading.
I have two questions:
- if I setUseCaches(true), why I must to wait until the file is all download an after I can read the InputStream?
- how can I get the progress download if setUseCaches(true) in the URLconnection?
very thanks

This is the code that I've used:
try{
     URLConnection urlconnection;
     urlconnection = (new URL(getDocumentBase(), "beni0271.jpg")).openConnection()
     urlconnection.setUseCaches(true);
     //If in the URLconnection I setUseCaches(true), I must to wait until the file is all download an after I can read the InputStream.
     //If in the URLconnection I setUseCaches(false), I can read the InputStream at the same time that the file is downloading.
     System.out.println(urlconnection);
     length =     urlconnection.getContentLength();
     inps = urlconnection.getInputStream();
     System.out.println(inps);
}catch(MalformedURLException e){
     System.out.println(e);
}catch(IOException e){
     System.out.println(e);
}

Similar Messages

  • Ipod freezing in the middle of songs, have to wait until the battery dies.

    Help me, my ipod freezes in the middle of songs and i have to wait until the battery goes out until i can do anything with it. And the harddrive has started to click and it sounds like a fan that starts spinning after two clicks. What should i do ?
    Pc   Windows XP   Ipod 5th generation

    you know what its funny because my ipod just did this last weekend. its been freezing on and off for the last couple of months. I have had it for a year and a half. It would freeze and i would try and do the whole thing where you hold down menu and select and that worked for awhile, but then suddenly last weekend it froze and it started making a weird clicking sound too. i got ****** and just left it at home for the weekend. when i got back home the battery was dead of course and i just plugged it into the charger and it turned on again. im guessing that sometimes you just have to leave it alone. when it made that clicking noise, it wouldnt do anything. you just have to let the battery die and then recharge it.

  • Wait until the session has been processed

    Hi folks,
    I have a report in which I create and trigger an SM35 session. I use RSBDCSUB report to do the same.
    Now, is there anyway to wait until the session has been processed? I mean, I need to do a few things in the report only after the session has been processed.
    Thanks
    Sagar

    Hi,
    You could try checking the job status (table TBTCO) inside a DO or WHILE loop.  To pause up to 5 seconds between your lookup on TBTCO, you can call function module 'RZL_SLEEP'. 
    If checking TBTCO does not work out for you, you can try the same loop logic with a call to function module 'ENQUEUE_BDC_QID' instead of looking up the job status.  If the enqueue has been released then the job has finished.
    Regards,
    James G.

  • Applet using  URLConnection.setUseCaches (true) cause OutOfMemoryError

    Hi all,
    I had this prloblem for a couple of weeks.
    We had a applet app that retrieve images and show on applet pages. On the applet page there are some image icon like print, rotation, copy ... on the sidebar, also I have two jar files including those classes and images on sever. When users access the applet page, the applet image (a document) show up immediately, but the button icon loading very slow one by one. From java console I can see one jar file which contain image icons were loaded multiple times and very slow about 8 to 10 minuts, after complete loaded, retrieve others will be fine.
    I think the cache set to false cause that.
                   urlConnection.setUseCaches (*false*);
                   urlConnection.setDefaultUseCaches (*false*);But if I set to true:
                   urlConnection.setUseCaches (*true*);
                   urlConnection.setDefaultUseCaches (*true*);My understanding is that allow to loading very image into local cache. After user retrieve images (about 30 times, they clicked on a document icon to show the image) for certain times, the browser frozen and java console show a error:
    com.ibm.mm.viewer.CMBDocumentEngineException: Java heap space
    java.lang.OutOfMemoryError: Java heap space
    I tried jre1.4.2, 1.5 and 1.6.0_02/_06/_10, didn't work!
    jre1.4.1 was fine but our user will use jre1.5 or higher.
    Anybody has a solution?
    Many thanks!!!
    Jx
    Edited by: cooooooooool on Nov 25, 2008 7:19 AM

    Ah, turns out I had to read the input too. Though I didn't produce much output myself in the script ;)

  • HT4623 I followed the directions to install the IOS 7.0.6 update to my Ipad Mini, but when I click on install and agree to terms & conditions, it says it is unable to verify the update because I am no longer connected to the internet. Not true. Help.

    I followed the directions to install the IOS 7.0.6 update to my Ipad Mini, but when I click on install and agree to terms & conditions, it says it is unable to verify the update because I am no longer connected to the internet. Not true. Help.

    Ok, got it now. I turned the Mini off and rebooted. Seems to be working fine now.

  • Error Deployer BEA-149231 Unable to set the activation state to true

    Hi Friends ,
    We are using weblogic 10.3.5.0, one of the deployment module is in failed status.
    In the application logs we could see the following error
    ERROR Util: Initial Spring Application Context creation failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [spring.xml]: Invocation of init method failed; nested exception is javax.naming.NoPermissionException: User <anonymous> does not have permission on comp.env.cpt to perform lookup operation
    in the weblogic server logs we could find the follow error
    <24-Jan-2013 08:47:43 o'clock CET> <Warning> <HTTP> <BEA-101162> <User defined listener org.apache.myfaces.webapp.StartupServletContextListener failed: java.lang.ExceptionInInitializerError.java.lang.ExceptionInInitializerError
    at com.db.cpt.biz.Utilities.Util.<clinit>(Util.java:114)
    at com.db.cpt.web.listener.MyPhaseListener.<clinit>(MyPhaseListener.java:26)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    Truncated. see log file for complete stacktrace
    Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [spring.xml]: Invocati
    on of init method failed; nested exception is javax.naming.NoPermissionException: User <anonymous> does not have permission on comp.env.cpt to perform lookup operation.
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1170)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
    Truncated. see log file for complete stacktrace
    Caused By: javax.naming.NoPermissionException: User <anonymous> does not have permission on comp.env.xxx to perform lookup operation.
    at weblogic.jndi.internal.ServerNamingNode.checkPermission(ServerNamingNode.java:443)
    at weblogic.jndi.internal.ServerNamingNode.checkLookup(ServerNamingNode.java:423)
    at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:180)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
    Truncated. see log file for complete stacktrace
    >
    <24-Jan-2013 08:47:43 o'clock CET> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application 'xxx'.
    weblogic.application.ModuleException:
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1510)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    Truncated. see log file for complete stacktrace
    Caused By: javax.naming.NoPermissionException: User <anonymous> does not have permission on comp.env.cpt to perform lookup operation.
    at weblogic.jndi.internal.ServerNamingNode.checkPermission(ServerNamingNode.java:443)
    at weblogic.jndi.internal.ServerNamingNode.checkLookup(ServerNamingNode.java:423)
    at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:180)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:214)
    Truncated. see log file for complete stacktrace
    Can you please advise us how can we resolve this issue which with i am struggling
    Raja

    Kumar,
    thanks for the update.
    we fixed the issue,
    for a particular user we didnt add his membership in a group in security realm, we added the user to a particular group, and then restarted weblogic, and deployed the module, and then status of deployment becomes successful.
    Raja

  • How do I make the Black in Pages True Black? I make Newspaper ads and they are starting to look anemic.

    How do I make the Black in Pages True Black? I make Newspaper ads and they are starting to look anemic.

    Sorry Eric but that is the wrong specification and will produce a muddy brownish grey with possible registration problems particularly in small type as well as being wasteful on ink.
    drdigest
    Open the Color Picker > click on the color slider tab > click on the color mode patch > choose Black & White > Brightness: 0% (black patch) > drag down to recognisable swatch below
    To label it > click on the color sets tab (3rd tab) > click on the gear > New > Rename the set "DrD's > drag down the swatch from the bar above > Label that 100k > click on any stray swatches and rempve by clicking on the - button below
    These swatches are System wide and available to any application that accesses the Color Picker. Unfortunately Apple has not seen fit to make them easily transferrable or saveable and importable.
    Make the 100k swatch part of your Styles in the Styles Drawer, particularly the text to ensure it is used, you can't spot it on screen and there is no feedback anywhere that it is selected.
    Peter

  • Sand Box has stopped working error when using System Exec.vi with wait until completion is true

    I get the following error message in Windows 7 "Sand Box has stopped working" when using System Exec.vi with wait until completion set to true, if I set it to false there is no error message.

    Hello JJVerdi
    mmm well System Exec.vi simulates a DOS command window, can you run the sandbox from the cmd window using the same commands without any errors? 
    you may take a look to this KB, it may be related to your issue:
    http://digital.ni.com/public.nsf/websearch/2393462​BD57B854186256C4F007B706A?OpenDocument
    Regards
    Mart G

  • Whenever I updated or downloaded a new app from the App Store, a message appears saying:   "Account Not In This Store Your account is not valid for use in the U.S. store. You must switch to the Swedish. store before purchasing."   I made some research onl

    Whenever I updated or downloaded a new app from the App Store, a message appears saying:
    "Account Not In This Store
    Your account is not valid for use in the U.S. store. You must switch to the Swedish. store before purchasing."
    I made some research online and asked a few of my friends with the same problem. All they did was sign out of iTunes from settings>iTunes & App Stores or from the App Store itself and signed back in. It worked for many of them but not with my iPhone 4s. It really does get on my nerves to always sign out and back in to the App Store as it sometimes works and allows me to update and download or most of the time it doesnt.
    When viewing my Apple ID account on my iPhone (after entering the password) it either views my account or says:
    "This Apple ID is only valid for purchases in the U.S. iTunes Store. You will be switched to that Store. Try your purchase again."
    So I press on OK then either switches me to the App Store app of its choice, or says "Cannot connect to iTunes Store".
    I tried restoring iOS6 hoping it was a bad installation, but i still have the same problem.
    Can anyone help me please?
    Arian

    Are you sure your AppleID is NOT tied to the US store? If you are trying to buy an app from the Swedish store you will be unable to do that. Some apps are only available on certain stores. That is why you get the "Cannot connect to the iTunes store" message when trying to buy that app. Your updates are being done from the US store ; thats why you can update sometimes and sometimes not.
    If you keep encountering problems contact iTunes support. They will help you sort it out.

  • Why do I get the message when I try to purchase an app or song on itunes using my iPhone5? "Account Not In This Store. Your account is not valid for use in the U.S. store. You must switch to the New Zealand store before purchasing."

    When I try to buy either an app or a song via iTunes, I have just started getting the following message and I am unable to change the store location. "Account Not In This Store. Your account is not valid for use in the U.S. store. You must switch to the New Zealand store before purchasing."
    This problem has only just started happening. I am on an iPhone5 iOS 7.0.4.
    Very frustrating. Can someone please tell me why & where the change has occured and how to fix it? In the past I have purchased many apps and songs on itunes and never had this problem.
    Thanks a mill :-)

    Click here and follow the instructions to change the iTunes Store country.
    (97125)

  • I am trying to authorise my new macbook air and it won't let me. I try to de-authorise all the other computers and it says I can only do this once a year and have to wait until the 7th Feb. It does not give me an option to authorise this computer

    I am trying to authorise my new macbook air for i-tunes and it won't let me. I try to de-authorise all the other computers and it says I can only do this once a year and have to wait until the 7th Feb. It does not give me an option to authorise this computer

    Always remember to 'de-authorize' you computer when selling or sending for service. If sending for repairs you might not get the same mother board or HD back and some how this counts as an authorized computer against your count.
    MJ

  • How do I do this to use OVerdrive media on deviceThe Apple device must be formatted for use with Microsoft Windows.  The iTunes setting 'Manually manage music-' must be enabled for the device before you can complete the transfer.

    I cannot make these directions work
    I downloaded media on Overdrive MEdia on my PC
    I have the overdrive media ap on my I pod touch 4g
    this media is suppossed to be compatible w/I pd touch
    Notes on Transferring OverDrive MP3 Audiobooks…
    Most MP3 capable devices should play OverDrive MP3 Audiobooks.
    If you intend to transfer OverDrive MP3 Audiobooks to an Apple® device, note the following…
    iTunes® v9.0.2 (or newer) is required.
    The Apple device must be formatted for use with Microsoft® Windows®.
    The iTunes setting 'Manually manage music…' must be enabled for the device before you can complete the transfer. Adjust this setting in iTunes as follows…
    Connect the iPod® to your computer.
    If it does not launch automatically, open iTunes v9.0.2 (or newer).
    In iTunes, locate the device in the left vertical navigation panel (under heading 'DEVICES'), and click the device.
    The 'Summary' screen is displayed. 
    Place a checkmark next to 'Manually manage music…'.
    Click the 'Apply' button.
    The iTunes 'Summary' screen refreshes, and the changes are saved.
    If desired, close iTunes.
    Note that if an Apple device is connected to your computer, you can choose to simultaneously transfer a title to the iTunes Library and the Apple device. If you wish to only transfer a title to the iTunes Library, you must first disconnect the Apple device

    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities
    Also you said " I want to add them to my iCloud, and also back to my computer.   " Note that unless  subscribe to iTunes match, only iTunes purchases are stored in iCloud.
    Also,
    You can redownload most iTunes purchases by:
      Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • The unlocked IPhone 4S models will not be available until November, Why is that? Why would Apple do that? I should be able to buy a factory unlocked Apple iPhone 4S when it comes out! Why is my interests being put last and Sprint, Verizon

    The unlocked IPhone 4S models will not be available until November, Why is that? Why would Apple do that? I should be able to buy a factory unlocked Apple iPhone 4S when it comes out! I travel all over the world, and so that is why I need one like that. It is unfair to the consumer, and frankly turning away customers like myself willing to pay high dollar to Apple for their product, who can I speak with to complain about this, because I know their are factory unlocked iPhone 4S' sitting in a warehouse somewhere just waiting to be shipped, and I want one.  I know why, cause Apple signed contracts with each carrier so the carrier could increase their sales making customers sign 2 year contracts, I get it, I own my own business, but the delay of releasing factory unlocked ones is just not right and I should be able to buy one without having to buy it over in the UK where it is unlocked when it comes out right away, I should be able to buy it in my own country!  These business practices we practice in the US need to stop, their is a demand that needs to be met with consumers like myself who don't need subsidized iPhone's with 2 year contracts with carriers and don't mine paying full price for an unlocked one, it is unethical in a sense, forcing the customer to buy it with a carrier contract and NOT giving the customer the option to buy it full price and own it themselves, OR, making the consumer wait a month for that option to be available.  THEY SHOULD BE RELEASED AT THE SAME TIME!!!!!!  THAT IS THE RIGHT THING TO DO!!!!!!
    Apple can contact me and I will proudly pay for one.  But making me wait a month for an unlocked one, puts AT&T, Sprint & Verizon's interests before mine, and that is not right, for it is MY money that keeps you guys in business, so my best interests should come first!!!!!!!!!!!!!!!!!!!

    I understand your frustration, but when any form of rationing is required you have to prioritise. The number of unlocked vs packaged phones will be quite small and the number of unlocked buyers wishing to upgrade immediately will be smaller still. Against this you have the corporations sharing $billions between them.
    It would, you're correct, have been fairer to release all at the same time, but fairer doesn't come into it: it's business.

  • HT2480 whenever i connect my iphone to pc while syncing mail in itunes a pop up" the connection is not available.outlook must be online or connected  to complete this action" please suggest me to solve this or bisable.

    whenever i connect my iphone to pc while syncing mail in itunes a pop up" the connection is not available.outlook must be online or connected  to complete this action" please suggest me to solve this or bisable.

    Cached exchange mode was already marked so that was not the issue.
    I have done all the usual of creating a new profile, reinstalling Outlook etc but nothing seemed to work. I also tried going back to Outlook 2007 and reinstalling Windows but same problem.
    However, I am not sure if it is connected but I was useing the option in MS Live Sync to synchronise Office settings which I turned off recently and now no longer have the issue. Unfortunately I cannot remember when in the process I did this so cannot be
    sure it was responsible - anyone else found this?

  • Greetings: I have multiple iPads and iPhones. I want all to be able to be able to stream to our Apple TV. All of the docs I see say you must have the same Apple ID for all the devices, but we each have our own Apple ID. Is this just a doc short coming?

    Greetings: I have multiple iPads and iPhones. I want all to be able to be able to stream to our Apple TV. All of the docs I see say you must have the same Apple ID for all the devices, but we each have our own Apple ID. Is this just a doc short coming?

    You can each have your own ID for your own iTunes accounts, but in order for a device to stream via AirPlay to the same Apple TV, everything must use the same homesharing ID. This is not the same as your iTunes account ID (although it can be for one of the devices)

Maybe you are looking for

  • New PC: how can I sync my Iphone with a new PC without loosing data?

    I have an old Windows Vista PC with Itunes. I want to sync my iPhone4 with a new Windows 8 PC. I only sync music and video with the iphone and itunes, NOT email adress contacts, etc (I do not want to mix and mingle all my contacts on PC and phone). I

  • Can't import RAW and psd file with same name different extension

    Trying to import a folder of images from desktop that I have been working with in Bridge CS3. LR won't import a RAW file that has a PSD file by the same name. Tried renaming the PSD and deleting the one with the same name, but says it is still there

  • IPhone sync on Windows XP - SyncServer keeps running after disconnect

    When connecting iPhone to sync, after disconnect process SyncServer.exe continues to run using more and more memory. Eventually, system is at 100%. Only way to stop it is to run AVG virus scan. Anyone else encountered this problem? Don't want to try

  • Program to produce multiplication table

    Hi all,      somebody tell me how to produce a multiplication table in abap. I tried doing this, the values are coming to the internal table but ia am unable to get the output. Please help me out cos i have to use a similar looping condition in my bd

  • Issue launching InDesign trial

    Hi, I have installed the InDesign trial but when i launch it i get the following error message "Unable to launch InDesign as you dont have sufficient permissions to access the preferences folder. Ensure that you have appropriate permissions and the r