Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Question in i/o concepts

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please explain,

For handling streams,

FileInputStream & FileOutputStream are preferred (or) FileReader & FileWriter is preferred.
i.e)FileInputStream/FileReader is preferred?
FileOutputStream/FileWriter is preferred?

and please tell why?
 
Ranch Hand
Posts: 317
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. FileInputStream/FileOutputStream is used to perform file operations by writing or reading bytes.
2. FileReader/FileWriter is used to perform file operations by writing or reading characters.

so FileInputStream/FileOutputStream are byte streams and FileReader/FileWriter are character streams.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Harpreet Singh janda wrote:1. FileInputStream/FileOutputStream is used to perform file operations by writing or reading bytes.
2. FileReader/FileWriter is used to perform file operations by writing or reading characters.

so FileInputStream/FileOutputStream are byte streams and FileReader/FileWriter are character streams.



There is not reason to learn FileInputStream/FileOutputStream they are not in exam.(expect in some serialization questions) .
 
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and also if you want to deal with real life problems..
you have to wrap the filereader and FileWriter Objects with the BufferedReader and BufferedWriter classes
 
Ranch Hand
Posts: 101
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

..(expect in some serialization questions) .


serialization isn't on the exam too.
 
reply
    Bookmark Topic Watch Topic
  • New Topic