DataInputStream twice on the same InputSrteam

The code below throws en exception:
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class TwiceDataInputStream {
     public static void main(String[] args) throws IOException {
          URL u1 = new URL("http://www.yahoo.com");
          InputStream is1 = u1.openStream();
          DataInputStream dis = new DataInputStream(is1);
          System.out.println(dis.readInt());
          dis.close();
          //NOT AN OPTION!
          //is1 = u1.openStream();
          dis = new DataInputStream(is1);
          //Exception here
          System.out.println(dis.readInt());
          dis.close();
          is1.close();
}My question is: what should I do to be able to use is1 again?

However, if you're trying to read from the same stream twice, you can't do it. You could use a PushbackInputStream, I guess, but that would kind of suck. A better approach would be to read once and then provide the bytes to the two different processing entities.

Similar Messages

  • Can someone please tell me why when I order an Itunes app. , do I always get charged twice for the same thing.  It has happened on two different occasions.  Does it have anything to do with having 2 different ipods linked to the same account?

    Can someone please tell me why when  i order an app on my sons ipod, do I get charged twice for it?   When I tried do report a problem with the charge, it said that I can not get a refund on that item.   This is the second time this has happened to me.   Does it have anything to do with having more then one ipod linked to the same account?   Thanks for any help you can give me!!!

    It has nothing to do with have more than one device using that account.
    After you purchase it once, you redownload it on other devices by the following, not like purchasing a new app.
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    If you really got charged twice for purchases the same app twice with the same account contact iTunes again by:
    Apple - Support - iTunes - Contact Us
    Make sure that they are really the same app first.

  • HT1420 I purchased new computers twice within the same year because they old were damaged in a storm.  However, I can't deauthorize/reauthorize the new computers.  How do I deal with this situation.

    I purchased new computers twice within the same year because they were damaged in a storm.  However, I can't deauthorize/reauthorize the new computers because it has been less than a year.  How do I deal with this situation?

    BrianBlaze wrote:
    I have 3 Computers at home, I am studying computer sciences and am constantly rerformatting my computers, installing windows and linux over and over again.... EVERYTIME I reformat I have to authorize the same computer and so it takes up one of my 5 authorized computers... Anyways after deauthorizing all my computers in september I was not aware I couldn't do it for another year (why does APPLE assume these stupid tactics prevent piracy). Anywysw I need to reach apple and have them make it so I can do it again. I had a similar problem with Playstation and when I called them they fixed it for me... even windows (which you can only have one serial per computer) made it easy because all I had to do was call them and they fixed it for me. Now I need APPLE to do the same and this is the only place I could see to actually say what is going on... I can't believe I have to do this with my iPhone... I wanted an mp3 player and a phone together and if I can't put new songs until September 20, 2012 I am going to freak out!
    HELP!
    Brian
    Try this link: http://www.howtogeek.com/howto/23974/beginner-deauthorize-all-computers-associat ed-with-your-itunes-account/

  • Required report for the invoice processed twice for the same PO & Vendor

    Hi SAP MM experts,
    I want a  report which is to identify the same invoice processed twice against the same vendor and same PO which system cannot detect only  because the invoice numbers are manually entered slightly different, and that is why I also want to include the document date of the invoice so that the possibility of identifying the duplicated invoices is increased.
    Any help will be highly appriciated.
    Thaks in advance
    Sachin Patil

    You might also refer reports ME80RN,ME2N,ME2L for purchase order or refer report MIR5 for vendor.
    Also refer report FBL1N - vendor open items,Check for document type - 'RE'
    Whether check for double invoice is ticked accounting view of  vendor master ? or else
    Check double invoice is configired for which combination in LIV SPRO ?

  • I was charged twice for the same order!

    I was charged twice for the same item; once for my online pre-order through BestBuy.com and again when I picked up the item at the Best Buy Store.
    I pre-ordered an Xbox One - Day One Edition from BestBuy.com on 09/02/2013. I scheduled to pick up the item at the Best Buy Store in Eden Prairie after the Microsoft release date of 11/22/2013. On 11/25/2013 I arrived at the Eden Prairie Best Buy excited to pick up my Xbox One - Day One Edition.
    The Best Buy staff had difficulty linking the pre-order to the in-store pick up. They couldn't confirm if I already paid for the item through BestBuy.com. They asked for my various email addresses and phone numbers and I was required to show them my ID which matched the name on the sticker which was placed on the side of the pre-ordered item. I waited 10-15 min at the checkout until the 3 Best Buy employees troubleshooting the transaction were satisfied. Little did I know, I was being charged twice for the same item! Once for my online pre-order through BestBuy.com and again at the store when I was picking up my item! The worst part is that during the confusion during the in-store pickup, the Best Buy staff created a new transaction ticket to complete the checkout. This created a new entry in their system which claimed that I picked up two Xbox One - Day One Editions! I would like to point out that the Day One Edition could only be obtained through the pre-order process, and only one pre-order was allowed per person!  (This was Best Buy's Policy) My transaction involved only one pre-order number! (removed per forum guidelines) This makes it impossible to sell me (2) Xbox One - Day One Editions.
    On 11/25/13 I received 2 paper documents along with (1) Xbox One - Day One Edition with serial number: (removed per forum guidelines) from the Eden Prairie Store.
    1. A Best Buy Pick-up Acknowledgement for $536.36 for order number (removed per forum guidelines). This document did not contain a serial number for the item. The document was printed at 6:31PM.
    2. A standard Best Buy receipt for $536.36 printed at 6:35PM. (4 minutes after the first document) This document did contain a serial number for the item: (removed per forum guidelines).
    Now for the two charges:
    1. The first charge on my card ending in 8754 was on 11/22/13 for $536.36 from BestBuy.com.
    2. The second charge on my card ending in 8754 was on 11/26/13 for $536.36 from Best Buy Eden Prairie.
    I noticed the additional charge error after I returned the item (that I was charged twice for -Serial Number: (removed per forum guidelines) on 01/02/14. I checked my account to make sure I was refunded and I noticed I was charged twice. At this time I spoke with the Best Buy Customer Service at the Best Buy Eden Prairie Store. They recommended I call the Best Buy number on the receipt to sort it out. I called the number and due to the holiday congestion I was unable to connect with a Best Buy Representative after waiting for an hour. I again contacted the Best Buy Customer Service at the Eden Prairie Store and they recommended I file a claim with my bank.(Wellsfargo)
    I filed a claim with WellsFargo ((removed per forum guidelines)) but after 4 weeks the issue did not get resolved.
    After the Wellsfargo claim failed I filed two new claim numbers with Best Buy in hopes that working with Best Buy:
    1. Best Buy Claim # (removed per forum guidelines)
    2. Best Buy Claim # (removed per forum guidelines)
    I also printed the following documents on 06/1/14 and presented them to the store manager for review:
    -Bank account statement showing the two charges 4 minutes apart.
    -A Best Buy Pick-up Acknowledgement
    -A standard Best Buy receipt
    -The return slip from the return on 01/02/14.
    -Screen captures of my email pre-order acknowledgement
    -Screen captures of my email pick-up acknowledgment.
    After spending 2 hours at the service desk I was denied a refund because Best Buy claimed two Xbox One -Day One Edition's were purchased by me, 4 minutes apart, however, Best Buy could only provide one serial number for the transaction. I stated that the claim could easily be settled if they provided the two serial numbers in their system that were sold to me with my signatures. They could not. It is frusterating as the customer because I know there was only one serial number involved in the transaction.
    I then filed a claim with the Better Business Bureau. Best Buy responded that their records show no inventory adjustments therefore they will not issue a refund. To prove that they sold me two xboxs they could simply provide the two serial numbers that they received payment for. Best Buy will not do this because they know they only have proof of one serial number in the transaction.
    I consider Best Buy's response unethical. I don't want to believe that they are in the business of stealing but their lack of understanding and willingness to entertain the possibility that they made a mistake is convincing me otherwise. If you can't prove you sold two items, you have no business in charging for two items. I can prove that I have been charged twice in error. I was also disappointed that they did not address the facts in my claim. Best Buy is losing a customer of over 20 years.
    Thank you for your time in reading my message.

    Hello Consumer777,
    I sincerely appreciate the amount of detail you’ve provided in your post. It appears you’ve been dealing with this scenario for quite some time, and I thank you for bringing it to our attention on the forums.
    I’ve reviewed your case history with Best Buy in regards to this issue, as well as the details of the Better Business Bureau (BBB) case that was opened. We provided our definitive response to the BBB and Best Buy’s decision on the matter has not changed.
    Thank you for sharing your feedback on the forums.
    Sincerely,
    Brian|Senior Social Media Specialist | Best Buy® Corporate
     Private Message

  • Have an imac with snow leopard and Firefox 3.6.13. On a prompt downloaded and installed Firefox 3.6.16. Firefox opening Screen still shows 3.6.13. Have done this twice with the same result. Any help?

    Imac, processor Intel core i3, Mac OS X version 3.6.6.
    On opening Firefox 3.6.13 firefox screen suggests downloading latest version. Have downloaded and installed Firefox 3.6.15 (sorry typing error in previous entry). On opening Firefox, screen still shows 3.6.13 as the operating version although "Get info" shows that updating has been done. Thinking I may have made a mistake I have done this twice with the same result. The screen is still telling me to update.
    Not really a problem using Firefox but I would like to know which version I am using.

    Your user agent in the More system details list shows that you have the Firefox 3.6.15 version
    *Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
    Where do you see "3.6.13" ?

  • Opening a pdf file twice in the same screen

    How can I open a pdf file twice in the same screen so that they are side by side?

    In Adobe Reader try the menu Window > New Window

  • Does not do the sorting if I click twice to the same column.

    Hello
    I am new to winforms.
    I have a listview. I want it to toggle the sorting of the records of the listview when the columns are clicked
    Please guide me as to how to do the same.
    The code that I have attached does not do the sorting if I click twice to the same column. I have to click a different column ten the previous column 
    The code is attached below
    regards
    Manoj Gokhale
    private void SiteInChargeorSupervisor_Load(object sender, EventArgs e)
    this.listView1.ColumnClick += new ColumnClickEventHandler(listView1_ColumnClick);
    private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
    ListViewSorter Sorter = new ListViewSorter();
    listView1.ListViewItemSorter = Sorter;
    if (!(listView1.ListViewItemSorter is ListViewSorter))
    return;
    Sorter = (ListViewSorter)listView1.ListViewItemSorter;
    if (Sorter.LastSort == e.Column)
    if (listView1.Sorting == System.Windows.Forms.SortOrder.Ascending)
    listView1.Sorting = System.Windows.Forms.SortOrder.Descending;
    else
    listView1.Sorting = System.Windows.Forms.SortOrder.Ascending;
    else
    listView1.Sorting = System.Windows.Forms.SortOrder.Descending;
    Sorter.ByColumn = e.Column;
    listView1.Sort();
    public class ListViewSorter : System.Collections.IComparer
    public int Compare(object o1, object o2)
    if (!(o1 is ListViewItem))
    return (0);
    if (!(o2 is ListViewItem))
    return (0);
    ListViewItem lvi1 = (ListViewItem)o2;
    string str1 = lvi1.SubItems[ByColumn].Text;
    ListViewItem lvi2 = (ListViewItem)o1;
    string str2 = lvi2.SubItems[ByColumn].Text;
    int result;
    if (lvi1.ListView.Sorting == System.Windows.Forms.SortOrder.Ascending)
    result = String.Compare(str1, str2);
    else
    result = String.Compare(str2, str1);
    LastSort = ByColumn;
    return (result);
    public int ByColumn
    get { return Column; }
    set { Column = value; }
    int Column = 0;
    public int LastSort
    get { return LastColumn; }
    set { LastColumn = value; }
    int LastColumn = 0;

    Every time through the ColumnClick event handler, you are creating a new sorter. This means that any values set in the sorter from the previous click are not saved.
    Try this.
    private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
    // Only create a new sorter if we don't have one already.
    if(listView1.ListViewItemSorter == null)
    ListViewSorter Sorter = new ListViewSorter();
    listView1.ListViewItemSorter = Sorter;
    // And so on with the rest of your code.

  • Using an WD Component twice within the same Component

    Hi all,
    our company has made a WD Component for editing business partners.
    My job is to build a WD Component where two business partners (different roles) are edited within the same window.
    My idea was to make 2 separate component usages of the Business Partner WD Component within my component.
    This just works fine. But there is a problem when mapping the context of both Business Partner-Components into my WD Component. There are always naming conflicts. This is because it is not allowed that there are two nodes with the same name in the context, even if they are in different subnodes. Renaming the nodes after mapping them in my component also doesn't work, because it is not possible to rename nested nodes.
    Does anyone know a solution?
    Kind regards,
    Florian

    Hi Anurag,
    thank you for giving me help. You are right, it is possible to use a component twice within the same webdynpro component.
    But the problem is the context mapping in the target component.
    Let me give you an example.
    This is the context of the twice used component.
    CONTEXT
    |
    |->NODE_1
    |  |
    |  |->SUBNODE_1
    |  |  |
    |  |  |->SUBSUB_NODE_1
    |  |  |  |
    |  |  |  |->ATTRIBUTE_1_1_1
    |  |  |  |->ATTRIBUTE_1_1_2
    |  |  |->SUBSUB_NODE_2
    |  |  |->SUBSUB_NODE_3
    |  |  |->ATTRIBUTE_1_1
    |  |  |->ATTRIBUTE_1_2
    |  |->ATTRIBUTE_1
    |  |->ATTRIBUTE_2
    |  |->ATTRIBUTE_3
    Now, if i map this context (NODE_1) to the target web dynpro component I have a problem. I have to map it twice (one time for each used component), so that i can access both used components. But WebDynpro only allows me to rename the node NODE_1. Mapped subnodes (SUBNODE_1, ...) cannot be renamed. So i cannot map the context of both used components, because there are always naming conflicts. WebDynpro doesn't allow that there are two nodes with identical names within the context, even if they are in different subnodes.
    Is there a solution? We really need one.
    Thanks
    Florian

  • How to Prevent/Control doing MIGO twice for the same material

    Dear
    The stores clerk by mistake has done MIGO twice for the same material.  Is there any way to prevent/check the same in standard SAP?  Vendor does not send the invoice/delivery challan to stores directly.  Invoice is sent to Finance Department. 
    Regards

    It is very unlikely that you could spec an ABAP solution to this problem.
    You may be able to spec an exit that would prevent GR being carried out for a PO Item twice on the same day.  But that is not infallible, as there may be valid circumstances when you would need to carry out two GR's for a PO item on the same day.  A fix for a small problem that creates a large one is not a good fix.
    You also need to ask how big this problem really is - if a user duplicates a goods receipt every once in a long while then you probably do not have a serious problem.
    Rather than look at a system fix for the error, I would suggest that you look at what you can do to improve the physical process.

  • OSB File polling working twice with the same file

    I have a problem executing a proxy service that get files from a file system. Everything in the flow works as expected, but at a certain point I must wait an update on a database and the process awaits for that change. Everthing goes normal if the update comes within the next 1-7 minutes, but after that if the process is still there(generally 9-11 minutes), a second process is called and the file processed is the same. After the first process is called the folder is empty so I can not understand why the proxy is called again with the same file, since there is nothing on the folder. This can happen since I am doing database modifications.
    The process is only invoked twice with the same file, no process is called again(A Third one) if the two processes are still working, wich is weird. since nothing in my proxy logic returns to the beginning.
    Does "Weblogic/OSB" tends to free resources on a specified time, such as "Max Stuck Thread Time" but for files or other resources?
    Any ideas why this is happening
    Thanks in advance.

    I think this is due to transaction timeout. The PolledMessageListenerMDBEJB under File Transport provider has a transaction timeout of 10 minutes. So if you are having a very long running transactions which spans more than the 10 minutes, you might see the rollback happening due to timeout.
    To confirm is this is the case, when this issue occurs, Go to JMS Modules >jmsResources >wlsb.internal.transport.task.queue.file_auto_n >Monitoring. You should see messages in messages pending column.
    click Show Messages. Click on a message and check Delivery count. This should have a value 1 or more which should mean message has been rolled back atleast once before.
    if it is the case you can try modifying the transaction timeout value of PolledMessageListenerMDBEJB under File Transport provider in deployments and then update the file transport provider deployment. Parallely check with support on what is the official recommendation for increasing timeout.

  • Why charged me twice for the same item? They have withdrew money from my bank account for the second time about half an hour later after the transaction was completed leaving me overdrawn.

    Why charged me twice for the same item? They have withdrew money from my bank account for the second time about half an hour later after the transaction was completed leaving me overdrawn.

    Hi Benjamins,
    I've checked your account—you have two ExportPDF subscriptions. One placed on October 20 2013, and the other placed on October 11 of this year. So, you were probably charged the auto renewal for the subscription placed in 2013, and then the new charge for this year's order.
    Please Contact Customer Care so that an agent can help get things situated for you. There's no reason to have two subscriptions to the same service, so an agent can help you cancel one, if you'd like.
    Best,
    Sara

  • HT204088 what do I do if I am charged twice for the same song?

    What do I do if I am charged twice for the same song?

    You can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • HT201303 I was charged twice for the same song how do I get reimbursed?

    I was charged twice for the same song how do I get reimbursed?

    You can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • HT3702 I was charged twice for the same purchases

    I was charged twice for the same groip of purchases how do i get my money back?

    You can contact iTunes support via this page (these are user-to-user forums) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

Maybe you are looking for

  • Keynote 09 Theme Chooser

    Hi! This just happened after I installed the current update of iWork 09 two days ago. Seems that I cannot select theme "Gradient" (which is my favorite and often used). The first slide came up plain with a big "X" across the entire slide. There was a

  • Dreamweaver template error -43

    Hi - Strange message and problem I just started getting with one of my sites. There is a subpages template that is in use, exists locally and on the server, and each subpage references the file. But when I updated the template, I wasn't prompted whet

  • CUSOM.pll is not compiling

    Hi DBA's CUSTOM.pll is not compiling, it is giving the following error, I tried in all instances it is giving the same problem, can you please guide me to resolve the issue. [applmgr@aqherptest resource]$ f60gen CUSTOM.pll apps/apps Forms 6.0 (Form C

  • How to call a function from a different script object?

    Hi All, Here is the scenario, I have 2 script objects A and B . In script object A i have a function called "funcA" and in script object B i have a function called "funcB" Now I want to call funcA from funcB which is not happening. I tried doing A.fu

  • KB2964358

    Hi, Is there anyone can confirm the KB dependencies in this? I have discovered those others post wih the followings suggestion: IE 8 & 10 KB2936068 KB2925418 IE 11 KB2929437 1) We have encountered below error: CiceroUIWndFrame: Outlook.exe - Ordinal