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