Java OutputStream flush() Method with Examples – Javatpoint

Java OutputStream flush() Method

The flush() method of OutputStream class is used to flush the content of the buffer to the output stream. A buffer is a portion in memory that is used to store a stream of data(characters). That data sometimes will only get sent to an output device, when the buffer is full.

The flush method of OutputStream does nothing.

Syntax

Specified By:

flush in interface Flushable

Throws:

IOException– If an I/O error occurs.

Example

Output:

A

Next Topic

Java OutputStream