Friday, May 29, 2009

Closeable and Flushable interfaces

The Closeable and Flushable interfaces define a uniform way for specifying that a stream can be closed or flushed.

Closeable: The objects that implement the Closeable interface can be closed. This interface defines the close() method.

void close() throws IOException

It closes the invoking stream and releases all the resources. It is implemented by all the I/O classes that open a stream.

Flushable: The objects that implement the Flushable interface can force buffered output to be written to a stream to which the objects are attached. This interface defines the flush() method.

void flush() throws IOException

No comments:

Post a Comment