Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: File reading/writing

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Thanked 0 Times in 0 Posts

    Default File reading/writing

    I've looked at multiple sources and everyone is saying different stuff. Which one should I be using? FileWriter/FileReader, other people was saying PrintWriter, and one even said : "Formatter" which is the one I'm doubting mostly. My purposes for writing files is for like saving maps, saving high scores, etc. Which one should I be using?

    - Nicky

  2. #2
    Senior Member
    Join Date
    Jul 2013
    Thanked 121 Times in 105 Posts

    Default Re: File reading/writing

    Really depends on what you want to do.
    Do you want to read serialized java objects? There is a writer and reader for that, the ObjectOutputStream / ObjectInputStream.
    Do you want to read primitive data? (int, double, etc) There are classes for that, DataOutputStream / DataInputStream.

    It really depends. Just find out what you want to do, and then find out which Stream class you need.

Similar Threads

  1. Reading and writing file
    By FaisalBahadur in forum File I/O & Other I/O Streams
    Replies: 6
    Last Post: June 12th, 2014, 05:38 PM
  2. File I/O reading from text and writing to another, PLEASE ADVISE! basic
    By Loki617 in forum File I/O & Other I/O Streams
    Replies: 14
    Last Post: April 16th, 2012, 01:29 PM
  3. Trouble with writing/reading array to/from file
    By MaximusPrime in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 4th, 2012, 08:41 PM
  4. file reading & writing
    By macko in forum What's Wrong With My Code?
    Replies: 7
    Last Post: May 12th, 2011, 08:54 AM
  5. Reading a writing binary file
    By stu1811 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: July 30th, 2010, 12:58 PM