Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-31-2007, 05:27 PM
Member
 
Join Date: Jul 2007
Posts: 40
baltimore is on a distinguished road
Help with File reading and writing
Hi, I am having problem and just need some coding lines that reads a file into an array so it can be edited in the array and than rewrites it to the file later on.

Also another question, is there a way to add more to an array with out creating a new one and so forth?

Thanks.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-31-2007, 07:47 PM
Senior Member
 
Join Date: Jul 2007
Posts: 134
brianhks will become famous soon enough
I would use a linked list (java.util.LinkedList) to put the lines in.

Code:
LinkedList lineList = new LinkedList(); BufferedReader br = new BufferedReader(new FileReader("FileName")); String line; while ((line = br.readLine()) != null) { lineList.add(line); } br.close();
On output I would use a PrintWriter and an Iterator over the LinkedList.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
writing and reading unicode characters from a file ranoosh Advanced Java 4 09-28-2008 05:34 AM
Reading data from Micrsoft excel and writing to notepad abhishek.jain New To Java 2 06-18-2008 01:24 PM
Reading/Writing a File using byte array Java Tip Java Tips 0 01-16-2008 11:41 AM
Reading/Writing files through Applet Java Tip Java Tips 0 12-15-2007 09:20 PM
writing to a file bugger New To Java 1 11-11-2007 03:49 AM


All times are GMT +3. The time now is 12:00 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org