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. @param flushable the Flushable object to be flushed. @param swallowIOException if true, don't p
(Flushable flushable, boolean swallowIOException)
| 49 | * @see Closeables#close |
| 50 | */ |
| 51 | public static void flush(Flushable flushable, boolean swallowIOException) throws IOException { |
| 52 | try { |
| 53 | flushable.flush(); |
| 54 | } catch (IOException e) { |
| 55 | if (swallowIOException) { |
| 56 | logger.log(Level.WARNING, "IOException thrown while flushing Flushable.", e); |
| 57 | } else { |
| 58 | throw e; |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Equivalent to calling {@code flush(flushable, true)}, but with no {@code IOException} in the |
no test coverage detected