Package com.google.common.io
Class Flushables
- java.lang.Object
-
- com.google.common.io.Flushables
-
@GwtIncompatible public final class Flushables extends Object
Utility methods for working withFlushable
objects.- Since:
- 1.0
- Author:
- Michael Lancaster
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
flush(Flushable flushable, boolean swallowIOException)
Flush aFlushable
, with control over whether anIOException
may be thrown.static void
flushQuietly(Flushable flushable)
Equivalent to callingflush(flushable, true)
, but with noIOException
in the signature.
-
-
-
Method Detail
-
flush
public static void flush(Flushable flushable, boolean swallowIOException) throws IOException
Flush aFlushable
, with control over whether anIOException
may be thrown.If
swallowIOException
is true, then we don't rethrowIOException
, but merely log it.- Parameters:
flushable
- theFlushable
object to be flushed.swallowIOException
- if true, don't propagate IO exceptions thrown by theflush
method- Throws:
IOException
- ifswallowIOException
is false andFlushable.flush()
throws anIOException
.- See Also:
Closeables.close(java.io.Closeable, boolean)
-
flushQuietly
@Beta public static void flushQuietly(Flushable flushable)
Equivalent to callingflush(flushable, true)
, but with noIOException
in the signature.- Parameters:
flushable
- theFlushable
object to be flushed.
-
-