Reputation: 13175
From OutputStream.flush()
docs.
Why does it state here in the doc that the flush method of OutputStream
does nothing after explaining that it actually does something? Very confusing.
Upvotes: 13
Views: 4037
Reputation: 28767
OutputStream
is an abstract class.
The deriving instance has to override that, if it needs a flush.
For example the BufferedOutputStream
.
Streams that have no buffer may not need to override flush()
.
Upvotes: 2
Reputation: 5571
The first part of the text is describing the general contract of flush
. Classes which extend OutputStream
are expected to adhere to this contract.
OutputStream
is an abstract class, but a default implementation of flush
is provided. As described, the implementation does nothing.
Upvotes: 0
Reputation: 272417
OutputStream
is an abstract class to be derived from. Subclasses will provide their own implementation if necessary. Otherwise the default behaviour is to do nothing.
e.g. see the code for ObjectOutputStream.flush()
Upvotes: 16