• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Diff BufferedReader's and FileReader's close method

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BufferedReader takes an instance of FileReader, what happens if we only call Bufferedreader's close method not FileReaders close method. does it guarantees other stream to close and vice versa.
[ August 22, 2007: Message edited by: Ameen khan ]
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any of the stream/reader classes that decorates others, closes the decorated stream also when its close is called. You dont need to close all the streams.
However, the vice-versa part is not correct i.e. if you wrap a FileReader with a BufferedReader, then closing FileReader will not close BufferedReader. It does not sound practical to demand that too. isnt?
[ August 22, 2007: Message edited by: Nitesh Kant ]
 
Yup, yup, yup. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic