Class Flushables

java.lang.Object
com.google.common.io.Flushables

public final class Flushables extends Object
Utility methods for working with Flushable objects.
Since:
1.0
  • Field Details

    • logger

      private static final Logger logger
  • Constructor Details

    • Flushables

      private Flushables()
  • Method Details

    • flush

      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 - the Flushable object to be flushed.
      swallowIOException - if true, don't propagate IO exceptions thrown by the flush method
      Throws:
      IOException - if swallowIOException is false and Flushable.flush() throws an IOException.
      See Also:
    • flushQuietly

      public static void flushQuietly(Flushable flushable)
      Equivalent to calling flush(flushable, true), but with no IOException in the signature.
      Parameters:
      flushable - the Flushable object to be flushed.