• 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?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!