Re: File I/O....which class to use?



Darth Tyrannus wrote:
I am barely learning Java and so far I have come across multiple
classes you can use for File I/O....


Which classes are most frequently used or preferred?

For example

FileOutputStream or FileWriter
FileInputStream or FileReader

Should I use BufferedReader? Is it necessary?

I know it depends on what is needed, but what is the most commonly used
classes for most programmers.

Thank you,
Paul


Readers for text, streams for bytes. Buffer as necessary for performance.

--

Knute Johnson
email s/nospam/knute/
.



Relevant Pages

  • Copying a file - performance
    ... I tested copying a character file in Windows using 2 approaches: ... Byte oriented - FileInputStream and FileOutputStream ... Character oriented - FileReader and FileWriter ...
    (comp.lang.java.programmer)
  • Re: Using the Stream Classes
    ... You send the FileOutputStream to the SendAndClearHandler and the ... DataInputStream from the FileInputStream. ... even manage do disguise the text of the original homework assignment ...
    (comp.lang.java.programmer)
  • Re: Wie lassen sich UTF-8 Dateien einlesen ???
    ... wenn Du die Zeichen darin verarbeiten willst, ... sondern vom System machen laesst mit BufferedReader und BufferedWriter, ... von FileInputStream in FileOutputStream, ohne Ruecksicht darauf, ...
    (de.comp.lang.java)
  • Re: Best way to allocate array within subroutine
    ... FileReader to allocate the array "one" and fill it with data, ... FileWriter using the 2 allocatable arrays. ... variables present in the CONTAINer. ... Make the main program into a subroutine called "UsedToBeMain". ...
    (comp.lang.fortran)
  • Re: copying files
    ... >that this must be done manually (FileOutputStream or FileWriter). ... >principle, this is no problem, but when I copy a file I want the resulting ... Coaching, problem solving, economical contract programming. ...
    (comp.lang.java.help)