コード例 #1
0
ファイル: Workbook.java プロジェクト: dhatim/fastexcel
 /**
  * Write a new file as a zip entry to the output writer.
  *
  * @param name File name.
  * @param consumer Output writer consumer, producing file contents.
  * @throws IOException If an I/O error occurs.
  */
 void writeFile(String name, ThrowingConsumer<Writer> consumer) throws IOException {
   synchronized (os) {
     os.putNextEntry(new ZipEntry(name));
     consumer.accept(writer);
     writer.flush();
     os.closeEntry();
   }
 }
コード例 #2
0
 public static <T> Consumer<T> unsafe(ThrowingConsumer<T> consumer) {
   return (a) -> {
     try {
       consumer.accept(a);
     } catch (RuntimeException e) {
       throw e;
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
   };
 }