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