How to use the readLine()  method when reading data from a URL?

Hello,
I have a URL which contains text input.
The only way to get the data from this URL is by opening a URL connection to it.
I would like to get the data from this URL but at the same time I would like to be able to use readLine() method of BufferedReader in order to read the data line by line.
My question is how do I combine between these two requirements in order to reed the data from the URL?
Roy

Hello Roy,
can you try out this code.
  URL yahoo = new URL("http://www.yahoo.com/");
        URLConnection yc = yahoo.openConnection();
        BufferedReader in = new BufferedReader(
                                new InputStreamReader(
                                yc.getInputStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
Regards,
Mohan R

Similar Messages

  • How to refresh the current page when retrieving data from database

    hi all
    in my application i want to navigate from different tables to different forms.  The data in the table and in the forms is comming fromthe database. when i select a navigation link to database of a form it is connecting to database.  so im manually refreshing the refresh button of I.E. which is big headache.  so is there any way to refresh my current table or form dynamically at run time to retrieve from database
    Thanks and regards
    khaja

    Hi,
      Refreshing a connection to Database means re establishing your connection each time.It will be load for the DB to load the data every time generally not advisable to do.
      Inorder to get the value from the DB you have load the driver and connect it using fireplug with the view for navigations.
      for the same refer this link.
    http://help.sap.com/saphelp_erp2004/helpdata/en/51/2c747ecd037842943bdb38be214719/frameset.htm
    Hope it helps.
    Rdgs,
    Guru

  • Error when reading data from XML using JAXB?

    Hi all,
    I get the error message when reading data from XML using JAXB.
    [org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException
    (AbstractUnmarshallerImpl.java:315)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:481)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:199)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:142)
    I don't find the reason, please help!
    Thanks in advance!

    The problem is sovled.

  • How to use the POST method In Oracle APEX 3.1

    Hi,
    In APEX if we are submitting the page the parameters( Variables ) will pass through URL.
    How to hide the these parameters from URL??
    I Hope POST method will solve this problem.
    How to use the POST method in APEX???
    Help me out to solve this problem.
    thanks in advance.
    Cheers,
    Shan

    In APEX if we are submitting the page the parameters( Variables ) will pass through URL.No they won't. Submission POSTs the <tt>wwv_flow</tt> form.
    Sometimes a branch may be performed after submission, generating a URL in which parameter values are visible. To avoid this, use the save state before branching option.
    Other actions&mdash;like using navigation lists, or clicking a link in a report&mdash;will perform a GET using parameters in the URL. In these cases using Session State Protection is advised.

  • How to use the index method for pathpoints object in illustrator through javascripts

    hii...
    am using Illustrator CS2 using javascripts...
    how to use the index method for pathpoints object in illustrator through javascripts..

    Hi, what are you trying to do with path points?
    CarlosCanto

  • HT201250 I had to replace the hard drive in my old MacBook. I replaced it. Installed OSX10.6. Then using the system software I reinstalled data from my Time Machine backup. On completion it asked for my password. It is not accepted. I am locked out how I

    I had to replace the hard drive in my old MacBook. I replaced it. Installed OSX10.6. Then using the system software I reinstalled data from my Time Machine backup. On completion it asked for my password. It is not accepted. I am locked out how I overcome this?
    I was already using 10.7. But only had the disc for 10.6.

    Sorry I am new to this. Am I in the right area? I am using my iPhone to make contact. I am worried.

  • How is the best way to read data from an iphone if you lost your itunes data after a crash?

    How is the best way to read data from an iphone if you lost your itunes data after a crash?

    How is the best way to read data from an iphone if you lost your itunes data after a crash?

  • Error when reading data from socket

    Hi,
    I am getting the error 'NiRawReadError: An error occured when reading data from socket.' when using the ABAP API  'mo_core_service->invoke_matching'.
    And I get this error only when I pass ABAP_TRUE to the paramter 'iv_wait_for_invocation' .
    Can anybody help me in correcting this?

    Hi Narasa,
    The following error is already in discussion in the below forum.Plz consult the forum link you will find the error solution.
    Problem in ABAP API - NiRawReadError: error when reading data from socket
    Rgds
    Ankit

  • Verizon is using the Elipsis tablets to steal data from their customers.  The only way to stop data from registering as cellular data is to pull the SIM card.  This occurs with wifi enabled and cellular,dara disabled.  If,you take your tablet to a Verizon

    Verizon is using the Elipsis tablets to steal data from their customers.  The only way to stop data from registering as cellular data is to pull the SIM card.  This occurs with wifi enabled and cellular,dara disabled.  If,you take your tablet to a Verizonstore they will upgrade your data plan to cover the overage and credit the upgrade.  You will then have to remember to downgrade your plan or continue to pay for more data.  Verizon, how would you feel if I walked into one of your stores and started filling my pockets with merchandise?  If cought can I just give the product back and say "oops, sorry"

    Today, my FCC complaint hit the same person working on the BBB complaint.  Jimmie has been very nice and seems willing to work with this problem.  We have been able to come to an agreement.  I paid the purchase price for the phone and he returned my upgrade and unlimited data plan.  This is what would have occurred if Verizon had given me correct information to begin with.  I am happy with this result.  He also brought quite a few instances concerning the handling of my transfer and upgrade that did not follow proper procedure.  I am also confident that I would not have resolved this without complaining to BBB and or FCC.  Verizon had no interest in solving the problem nor did they show any propensity to keeping a 20 year client.  Even though this last CSR was very polite and helpful, his sole job is to respond to formal Federal and State complaints.  He is required by law to address every complaint and report the reporting agency the agreed upon results - good or bad.  Again, I suggest - If you are not getting the proper customer service, complain to someone outside of Verizon.  Jimmie had not received any complaints registered with Verizon directly and I still have not had any contact with any other management representative that I was told would call.

  • I used the Migration Assistant to move data from my Time Machine to my new Mac.   Most data has been moved successfully but none of my iPhoto pictures have been moved.   Looking at my Time Machine now I find that the earliest back-up is dated after the Mi

    I used the Migration Assistant to move data from my Time Machine to my new Mac.   Most data seems to have been transferred successfully but none of my iPhoto pictures have been transferred.
    My Time Machine now shows the earliest available Back-up to be after the Migration Date.   My iPhoto pictures seem to have either been lost in the migration process or are locked in my Time Machine prior to the earliest back-up date now accessible.  
    Any advice on recovering my old iPhoto pictures would be greatly appreciated.

    First go to iPhoto Preferences, look in both General and Advanced tabs to make sure that things are set to import from camera into iPhoto.
    Then if that doesn't help, connect the camera and open Image Capture in your Applications > Utilities folder and see if you can use Image Capture to reset the import path from the camera to iPhoto.
    Image Capture: Free import tool on Mac OS X - Macgasm
    Message was edited by: den.thed
    Sorry John, I didn't see your post when I clicked the reply button. Dennis

  • How to skip the '\n' char when reading with BufferedReader

    Hello to all the comunity that is at these forums, ;)
    I'm a venezuelan IT student, and as many arround here, I'm looking for some help with this homework...
    well the thing is that I need to read from the System.in untill I get the "" String. Well the initial idea was to make a BufferedReader object and put the br.readLine(); method inside a recursive method, like this:
       import java.io.*;
        public class P1_diccionary {
          String[] diccionario;
          int cont=0;
           void llenarDiccionario(String linea, String[] auxi)throws IOException{
             if(linea.compareTo("")!=0){
                 int aux = cont++;
                 diccionario = new String[cont];
                 for(int i=0;i<auxi.length;i++)
                     diccionario=auxi[i];
    diccionario[aux]=linea;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    llenarDiccionario(reader.readLine(),diccionario);
    well, I think this one it's a nice idea, however, it doesn't work for me because the input is going to be just like this:
    word1: concept1...
    word2: concept2...
    word3: concept3...
    word4: concept4...
    and! it's going to be pasted on the console (that is "ctrl+c" then "ctrl+v")... that's the real problem that I have, the method that I did reads some lines not all of them, I think it's because there is no synchronization (guessing) between the ctrl+v and the execution of the program...
    so I thought about skiping the '\n' char, to do this I checked the readLine() method of the BufferedReader and found out that it calls a
    readLine(boolean ignoreLF)method and that ignoreLF and skipLF -boolean form the class- determine whether readLine() will skip the '\n' char or not:
    boolean omitLF = ignoreLF || skipLF;ok now the question: how do I make ignoreLF or skipLF = true? I tried to look more in the BufferedReader class but I didn't see how to change the skipLF value...
    well guess that's all, I'll really apriciate all of your help, and any other ideas that you might have to solve the problem...
    well thanks to everybody and see ya ;)

    Use read() instead of readLine(). This method will read characters, and does not treat the EOL charactger the same way. Just keep reading until you find a sequence of characters (two EOL sequences in a row) that matches your end condition. Just be careful, since different OSs have different EOL sequences ... \n, \n\r, or \r. Also, remember that you will have to deal with the EOL sequences. They will not be discarded automatically.
    You can also use read( char[], int, int) to read as many characters as you want, without regard to EOL sequences. This will only stop reading when EOF is reached, or when the next read will cause the underlying stream to block, or when you have read a specified number of characters. Again, this will not terminate at a EOL sequence, and will include the EOL sequences in your array.
    As far as readLine() is concerned, I think you want to stop when you have TWO successive reads that equal "".
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to get the Full and final settelment date from PC_payresults

    Hi Experts..sairam.
    We are preparing Functional specification  for a report on Full and final settelement.
    We need to extract the  full and final settelement date from  payresults.
    Full and final settelement would be an offcycle run.
    How can we identify the particular Offcycle is meant for full and final settelment.
    Full and final settelement can be done after date of relieving.
    Please share your ideas to get the field names and logic to fetch.
    Thanks in advance.
    Regards,
    Sairam.

    Hi Praveen,
    I found it from HRPY_RGDIR through SE11.
    But im in confusion in thinking on Logic to find the Full and final settelment processed date.
    First of all..Report has to check WPBP table weather Employment status is Zero.
    Later..It has to read the HRPY_RGDIR table.
    Here what the system to check.What conditions to be validated to fetch the Full and final settelment processed date.Will it be FPPER and INPER as 00000000 or shall we do it from offcycle reason.
    Please share your ideas.Thanks in advance.
    Regards,Sairam.

  • How to use the current connection when calling db procedure ?

    dear all,
    Am using Jdevleoper 11.1.1.3 ,
    I have a java class that call a database procedure , now everything is going fine with me but a bit slow bcoz am openning a new connection I think it would be definitely faster if am using the current connection
    so how can i re-write my code so i can use the current connection istead of defining a new connection to the DB :
    public void DeleteApp (int PAppNo){
    String username,password,thinConn;
    username = "ACC";
    password = "ACC";
    thinConn = "jdbc:oracle:thin:@..."
    try {
    DriverManager.registerDriver(new OracleDriver());
    Connection conn = DriverManager.getConnection(thinConn, username, password);
    CallableStatement cs = conn.prepareCall(" { call myprocedure(?,?,?) } ");
    cs.setInt(1,PAppNo);
    Thanks for all,
    Lama

    Delta,
    You shound NOT be doing JDBC calls from your UI project. You should put the code as a service method in your application module, expose the service method to the client, and then call it through the binding layer from your UI http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcservices.htm#sm0212
    thx John & timo but u always post the same reply at the same time for my questionsTimo and I have been around long enough that we recognize the questions that have been posted 9,461,293,811 times before and know the stock answers, and know where in the documentation the answers are given. As you appear to be new to ADF, I'd strongly recommend reading the Fusion Developer's Guide (skim it once and then read in detail the parts that interest you). As I've said before, so many of the basic (and not-so-basic) concepts are covered in there. Once you've skimmed it in enough detail, then the next time you have a problem, you might not know the answer, but you'll remember, "ah, I think I read something about that before, let me check..."
    John

  • How to use the complete method for as3 FLV component

    Hi team,
    I am using an FLV component dragged to the stage and then bringing in video content.  How can I make it visible=false when it has finished playing using the COMPLETE event?
    Cheers.
    sub

    if your component's instance name is flv_pb, use:
    flv_pb.addEventListener(Event.COMPLETE,completeF);
    function completeF(e:Event):void{
    flv_pb.visible=false;

  • How to use the is_selected method of if_wd_context_element API

    HI,
    scenario : if the element is selected, I want to pass some of its attributes to the backend.
    description : In a Context node, I want to check which elements are selected by the user. For this there is a method in the in if_wd_context_elemenent API in web dynpro ABAP. The method is called is_selected. How to use this method ?
    Please give me an example. What does this method return. can I use it in the if condition.
    Regards
    seventyros
    Edited by: seventyros on May 5, 2011 9:32 AM

    Hi tryos,
    IS_SELECT method is available at element and node level.
    check this...
    http://help.sap.com/saphelp_nw04s/helpdata/en/fd/be5b4150b38147e10000000a1550b0/content.htm
    Check this is set_selected method, try with is_select also...
    Select All in table
    if lo_el_it_lips->is_selected ( flag = abap_true ).
    endif.
    // Node
    DO count TIMES.
    lo_nd_it_lips1->is_selected(             // lo_el_it_lips - element has no index, only flag.
    flag = abap_true
    index = int ).
    ADD 1 TO int.
    ENDDO.
    Cheers,
    Kris.
    Edited by: kissnas on May 5, 2011 9:49 AM

Maybe you are looking for

  • Question about Memory Upgrade for iMac G3/350 - Slot Loading

    I was thinking of upgrading my memory and found this on eBay http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=350070149602 The auction says that it won't work in an apple computer but it looks like it should. Any help would be appreciated. Thanks,

  • Recovery is repairing media corrupt block x of file x in standby alert log

    Hi, oracle version:8.1.7.0.0 os version :solaris  5.9 we have oracle 8i primary and standby database. i am getting erorr in alert log file: Thu Aug 28 22:48:12 2008 Media Recovery Log /oratranslog/arch_1_1827391.arc Thu Aug 28 22:50:42 2008 Media Rec

  • Gray filter too dark. How to enlight the gray images?

    I�m creating a set of toolbar buttons and I want to acquire that disabled gray effect ... in my current code, I load two images for each button - an active one and the gray one... recently I heard about the GrayFilter class and I tryied to use it wit

  • Boolean in a combo with "no selection label"

    Does anyone know how to display a boolean value in a combobox with a "no selection label" ? If it's a primitive boolean, false is bound to the control by default. If the property is Boolean it causes Property 'foo' not readable on type java.lang.Bool

  • S12 ION BIOS

    Hi! I'm searching like crazy for the BIOS already installed on my S12 ION. The BIOS is called 21CN24WW. There is no BIOS available on the end-user site for this notebook. only for the VIA version. I have however googled the BIOS 21CN24WW and the firs