Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Readers and Stream classes can be chained?  RSS feed

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can we chain Reader classes with Stream classes?One of the practice exam has correct answere for reading a large text file like this:
new BufferedReader(new InputStreamReader(new FileInputStream("file.name")));
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See that InputStreamReader class? That's the bridging class that does the trick.
There is also an OutputStreamWriter for going the other way.
-Barry
 
Ghazala Islam
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean to say we can pass FileInputStream as parameter because it is InputStreamreader,but if it was Buffered reader?
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!