Java Code Examples for java.io.Flushable#flush()
The following examples show how to use
java.io.Flushable#flush() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IOUtils.java From AndServer with Apache License 2.0 | 5 votes |
public static void flushQuietly(Flushable flushable) { if (flushable != null) { try { flushable.flush(); } catch (Exception ignored) { } } }
Example 2
Source File: IOUtils.java From NoHttp with Apache License 2.0 | 5 votes |
public static void flushQuietly(Flushable flushable) { if (flushable != null) try { flushable.flush(); } catch (Exception ignored) { } }
Example 3
Source File: IOUtils.java From BaseProject with Apache License 2.0 | 5 votes |
public static void flushQuietly(Flushable flushable) { if (flushable == null) return; try { flushable.flush(); } catch (Exception e) { OkLogger.printStackTrace(e); } }
Example 4
Source File: Flushables.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
/** * Flush a {@link Flushable}, with control over whether an {@code IOException} may be thrown. * * <p>If {@code swallowIOException} is true, then we don't rethrow {@code IOException}, but merely * log it. * * @param flushable the {@code Flushable} object to be flushed. * @param swallowIOException if true, don't propagate IO exceptions thrown by the {@code flush} * method * @throws IOException if {@code swallowIOException} is false and {@link Flushable#flush} throws * an {@code IOException}. * @see Closeables#close */ public static void flush(Flushable flushable, boolean swallowIOException) throws IOException { try { flushable.flush(); } catch (IOException e) { if (swallowIOException) { logger.log(Level.WARNING, "IOException thrown while flushing Flushable.", e); } else { throw e; } } }
Example 5
Source File: Flushables.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
/** * Flush a {@link Flushable}, with control over whether an {@code IOException} may be thrown. * * <p>If {@code swallowIOException} is true, then we don't rethrow {@code IOException}, but merely * log it. * * @param flushable the {@code Flushable} object to be flushed. * @param swallowIOException if true, don't propagate IO exceptions thrown by the {@code flush} * method * @throws IOException if {@code swallowIOException} is false and {@link Flushable#flush} throws * an {@code IOException}. * @see Closeables#close */ public static void flush(Flushable flushable, boolean swallowIOException) throws IOException { try { flushable.flush(); } catch (IOException e) { if (swallowIOException) { logger.log(Level.WARNING, "IOException thrown while flushing Flushable.", e); } else { throw e; } } }
Example 6
Source File: Flushables.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
/** * Flush a {@link Flushable}, with control over whether an {@code IOException} may be thrown. * * <p>If {@code swallowIOException} is true, then we don't rethrow {@code IOException}, but merely * log it. * * @param flushable the {@code Flushable} object to be flushed. * @param swallowIOException if true, don't propagate IO exceptions thrown by the {@code flush} * method * @throws IOException if {@code swallowIOException} is false and {@link Flushable#flush} throws * an {@code IOException}. * @see Closeables#close */ public static void flush(Flushable flushable, boolean swallowIOException) throws IOException { try { flushable.flush(); } catch (IOException e) { if (swallowIOException) { logger.log(Level.WARNING, "IOException thrown while flushing Flushable.", e); } else { throw e; } } }
Example 7
Source File: Flushables.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
/** * Flush a {@link Flushable}, with control over whether an {@code IOException} may be thrown. * * <p>If {@code swallowIOException} is true, then we don't rethrow {@code IOException}, but merely * log it. * * @param flushable the {@code Flushable} object to be flushed. * @param swallowIOException if true, don't propagate IO exceptions thrown by the {@code flush} * method * @throws IOException if {@code swallowIOException} is false and {@link Flushable#flush} throws * an {@code IOException}. * @see Closeables#close */ public static void flush(Flushable flushable, boolean swallowIOException) throws IOException { try { flushable.flush(); } catch (IOException e) { if (swallowIOException) { logger.log(Level.WARNING, "IOException thrown while flushing Flushable.", e); } else { throw e; } } }
Example 8
Source File: IOUtils.java From AndPermission with Apache License 2.0 | 5 votes |
public static void flush(Flushable flushable) { try { flushable.flush(); } catch (IOException e) { e.printStackTrace(); } }
Example 9
Source File: IOUtils.java From okhttp-OkGo with Apache License 2.0 | 5 votes |
public static void flushQuietly(Flushable flushable) { if (flushable == null) return; try { flushable.flush(); } catch (Exception e) { OkLogger.printStackTrace(e); } }
Example 10
Source File: IOUtils.java From DoraemonKit with Apache License 2.0 | 5 votes |
public static void flushQuietly(Flushable flushable) { if (flushable == null) return; try { flushable.flush(); } catch (Exception e) { OkLogger.printStackTrace(e); } }
Example 11
Source File: IoUtils.java From FireFiles with Apache License 2.0 | 5 votes |
/** * Closes 'closeable', ignoring any checked exceptions. Does nothing if 'closeable' is null. */ public static void flushQuietly(Flushable flushable) { if (flushable != null) { try { flushable.flush(); } catch (RuntimeException rethrown) { throw rethrown; } catch (Exception ignored) { } } }
Example 12
Source File: IoUtils.java From FireFiles with Apache License 2.0 | 5 votes |
/** * Closes 'closeable', ignoring any checked exceptions. Does nothing if 'closeable' is null. */ public static void flushQuietly(Flushable flushable) { if (flushable != null) { try { flushable.flush(); } catch (RuntimeException rethrown) { throw rethrown; } catch (Exception ignored) { } } }
Example 13
Source File: IoUtils.java From FireFiles with Apache License 2.0 | 5 votes |
/** * Closes 'closeable', ignoring any checked exceptions. Does nothing if 'closeable' is null. */ public static void flushQuietly(Flushable flushable) { if (flushable != null) { try { flushable.flush(); } catch (RuntimeException rethrown) { throw rethrown; } catch (Exception ignored) { } } }
Example 14
Source File: CommonUtils.java From letv with Apache License 2.0 | 5 votes |
public static void flushOrLog(Flushable f, String message) { if (f != null) { try { f.flush(); } catch (IOException e) { Fabric.getLogger().e(Fabric.TAG, message, e); } } }
Example 15
Source File: Csv.java From financisto with GNU General Public License v2.0 | 5 votes |
public Writer flush() { try { if (appendable instanceof Flushable) { Flushable flushable = (Flushable) appendable; flushable.flush(); } } catch (java.io.IOException e) { throw new IOException(e); } return this; }
Example 16
Source File: Utils.java From text-ui with GNU General Public License v3.0 | 5 votes |
/** * Flush the flushable and catch any exception thrown. * * @param flushable the flushable to flush * @return any Exception thrown during the <code>flush</code> operation */ public static Exception flush(Flushable flushable) { if (flushable != null) { try { flushable.flush(); } catch (Exception e) { return e; } } return null; }
Example 17
Source File: CommonUtils.java From firebase-android-sdk with Apache License 2.0 | 5 votes |
public static void flushOrLog(Flushable f, String message) { if (f != null) { try { f.flush(); } catch (IOException e) { Logger.getLogger().e(message, e); } } }
Example 18
Source File: IOUtils.java From Kalle with Apache License 2.0 | 5 votes |
public static void flushQuietly(Flushable flushable) { if (flushable != null) try { flushable.flush(); } catch (Exception ignored) { } }
Example 19
Source File: IOUtils.java From DoraemonKit with Apache License 2.0 | 5 votes |
public static void flushQuietly(Flushable flushable) { if (flushable == null) return; try { flushable.flush(); } catch (Exception e) { OkLogger.printStackTrace(e); } }
Example 20
Source File: Flushables.java From codebuff with BSD 2-Clause "Simplified" License | 3 votes |
/** * Flush a {@link Flushable}, with control over whether an {@code IOException} may be thrown. * * <p>If {@code swallowIOException} is true, then we don't rethrow {@code IOException}, but merely * log it. * * @param flushable the {@code Flushable} object to be flushed. * @param swallowIOException if true, don't propagate IO exceptions thrown by the {@code flush} * method * @throws IOException if {@code swallowIOException} is false and {@link Flushable#flush} throws * an {@code IOException}. * @see Closeables#close */ public static void flush(Flushable flushable, boolean swallowIOException) throws IOException { try { flushable.flush(); } catch (IOException e) { if (swallowIOException) { logger.log(Level.WARNING, "IOException thrown while flushing Flushable.", e); } else { throw e; } } }