Results 1 to 2 of 2
  1. #1
    africanhacker is offline Senior Member
    Join Date
    Feb 2011
    Posts
    107
    Rep Power
    0

    Default Store links in text file and read into variables

    Hie guys, quick question. I am trying implement an automated reader for a few news websites.

    The problem is finding a way to know which links have already been visited.

    So what I thought of is using a text file that stores all the links that were present on the page during the last program run and using basic string comparison to determine which ones are new.

    Java Code:
    if(oldString.equals(newString)){
    visit link and do some nice stuff
    }
    This would probably make more sense in a loop of some sort, iterating through all the links stored in our text file and comparing the to the links currently on the web page concerned

    After the process is completed the text file would be overwritten with new.

    Now my question. How could I go about actually taking a link from a text file and putting it in a variable so I can compare it?

    Again is this the best thing to do. I am doing this as part of my coding practice for the summer and am very interest in good design patterns and would be very interested to heart alternatives if my approach is not sound.

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    you just need a List of visited websites, serialize it + open it the next time you run your program

Similar Threads

  1. Store Text-file Into 2D Array
    By benn22 in forum New To Java
    Replies: 20
    Last Post: 03-09-2011, 09:17 PM
  2. Need a solution to read and store data from a file
    By sheetalnri in forum New To Java
    Replies: 10
    Last Post: 09-30-2010, 06:43 AM
  3. Replies: 5
    Last Post: 07-30-2008, 09:30 AM
  4. Replies: 4
    Last Post: 06-09-2008, 04:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •