Example #1
0
 public void flushQuietly(Flushable s) {
   if (s != null) {
     try {
       s.flush();
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
 }
Example #2
0
  protected boolean flush(Flushable flushable) {
    if (flushable != null) {
      try {
        flushable.flush();

        return true;
      } catch (IOException e) {
        // mute
      }
    }

    return false;
  }
Example #3
0
 public static void close(final Closeable closeable) {
   if (closeable == null) return;
   try {
     if (Flushable.class.isInstance(closeable)) {
       ((Flushable) closeable).flush();
     }
   } catch (Throwable e) {
     // Ignore
   }
   try {
     closeable.close();
   } catch (Throwable e) {
     // Ignore
   }
 }
Example #4
0
 /**
  * Method that will close an {@link java.io.Closeable} ignoring it if it is null and ignoring
  * exceptions.
  *
  * @param closeable the closeable to close.
  * @since jEdit 4.3pre8
  */
 public static void closeQuietly(Closeable closeable) {
   if (closeable != null) {
     try {
       if (closeable instanceof Flushable) {
         ((Flushable) closeable).flush();
       }
     } catch (IOException e) {
       // ignore
     }
     try {
       closeable.close();
     } catch (IOException e) {
       // ignore
     }
   }
 } // }}}
Example #5
0
 /**
  * Method that will close a {@link Writer} ignoring it if it is null and ignoring exceptions.
  *
  * @param out the Writer to close.
  */
 public static void closeQuietly(Writer out) {
   if (out != null) {
     try {
       if (out instanceof Flushable) {
         ((Flushable) out).flush();
       }
     } catch (IOException e) {
       // ignore
     }
     try {
       out.close();
     } catch (IOException e) {
       // ignore
     }
   }
 }
Example #6
0
 public static void flush(Object o) throws IOException {
   if (o instanceof Flushable) ((Flushable) o).flush();
 }