Top Description Fields Constructors Methods
com.google.common.io

public final Class Flushables

extends Object
Class Inheritance
Annotations
@J2ktIncompatible
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.Beta, .GwtIncompatible, .J2ktIncompatible, java.io.Flushable, .IOException, java.util.logging.Level, .Logger

Utility methods for working with Flushable objects.
Author
Michael Lancaster
Since
1.0

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
flush(Flushable
the Flushable object to be flushed.
flushable
,
boolean
if true, don't propagate IO exceptions thrown by the flush method
swallowIOException
)

Flush a Flushable, with control over whether an IOException may be thrown.

public static void
flushQuietly(Flushable
the Flushable object to be flushed.
flushable
)

Equivalent to calling flush(flushable, true), but with no IOException in the signature.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final Logger logger

Constructor Detail

Flushablesback to summary
private Flushables()

Method Detail

flushback to summary
public static void flush(Flushable flushable, boolean swallowIOException) throws IOException

Flush a Flushable, with control over whether an IOException may be thrown.

If swallowIOException is true, then we don't rethrow IOException, but merely log it.

Parameters
flushable:Flushable

the Flushable object to be flushed.

swallowIOException:boolean

if true, don't propagate IO exceptions thrown by the flush method

Exceptions
IOException:
if swallowIOException is false and Flushable#flush throws an IOException.
See Also
Closeables#close
flushQuietlyback to summary
public static void flushQuietly(Flushable flushable)

Equivalent to calling flush(flushable, true), but with no IOException in the signature.

Parameters
flushable:Flushable

the Flushable object to be flushed.

Annotations
@Beta