Java Tutorial for Beginners C02L05 BufferedReader and CSV files

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
826 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 3, 2011

Hello everyone, in this tutorial we are going to be looking at how to take in data from a CSV (comma separated values table) into our program ready for processing. We also learn how to throw exceptions (do not throw exceptions if you can help it, instead go to my 11th tutorial to learn how to handle exceptions properly)

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (samblackwell1988)

  • @DarthSatoris So if I am reading this right you want to store your values something like this:

    9002,myPassword,myServer and then parse this into an array as i have shown you above then use the values to set up a server connection using jdbc? If this is the case then yes you could do it like this. You may also want to have a look at Spring injection which is how I deal with this issue.

  • excuse me , what happens if you didn't close the bufferedreader, in other words if you didnt type br.close ()

  • @fokyoz Well I close it because it is good practice to close streams as soon as you are done with them but I have had instances where errors have occurred due to me not closing the stream. In this case the stream being left open is not an efficient use of our resources so closing it releases resources for future use. I advocate people trying these things out if only to experience the pains of not following best practices :)

see all

All Comments (5)

Sign In or Sign Up now to post a comment!
  • In case I want to use a text file to store values for an SQL server connection, (port number, password, SQL server name, etc.), would I be doing just like this and insert the values from the arraylist in the required places? like ds.setServerName("ArrayList.ge­t(0)");

    ?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more