Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the deal with the Closeable and Flushable interfaces?

deal flushable interfaces
0
Posted

What is the deal with the Closeable and Flushable interfaces?

0

Location: http://www.jguru.com/faq/view.jsp?EID=1255936 Created: Jul 31, 2005 Author: John Zukowski (http://www.jguru.com/guru/viewbio.jsp?EID=7) The ability to close() or flush() an object (typeically a stream) has been factored out into single method interfaces, Closeable and Flushable, respectively. Given that you sometimes need to operate on different types of objects, like InputStream, OutputStream, RandomAccessFile, and Formatter, when your done working with the class, you don’t always care what it was you operated on. Thus, instead of having different “done” like methods to close or fLush the object, you can deal with just one for all types, as long as they implement Closeable or Flushable.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123