云自無心水自閑

          天平山上白云泉,云自無心水自閑。何必奔沖山下去,更添波浪向人間!
          posts - 288, comments - 524, trackbacks - 0, articles - 6
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          2017年6月26日

          1. java zip 多個文件時,如果先添加了一個excel文件,然后再想添加其他的文件時會出現 steam is closed的錯誤。這是因為work.write(outputSteam)后,出調用outputSteam.close(),關閉輸出流。
          解決方法:
          將原來的程序:
                      ZipEntry entry = new ZipEntry( "file3.txt" );
                      zos.putNextEntry( entry );
                      workbook.write( zos );
                      zos.closeEntry();
          改為:
                      ZipEntry entry = new ZipEntry( "file3.txt" );
                      zos.putNextEntry( entry );
                      workbook.write( new NonCloseableOutputStream( zos ) );
                      zos.closeEntry();

          其中 NonCloseableOutputStream 定義如下:
          public class NonCloseableOutputStream extends java.io.FilterOutputStream {
              public NonCloseableOutputStream(OutputStream out) {
                  super(out);
              }
              @Override public void close() throws IOException {
                  flush();
              }
          }



          2. 使用binary使得mysql區(qū)分大小寫
          select * from table1 where binary field1 = 'abc';

          posted @ 2017-08-09 19:52 云自無心水自閑 閱讀(442) | 評論 (0)編輯 收藏

          https://notepad-plus-plus.org/community/topic/13661/plugin-manager-x64-available-submit-your-plugins

          posted @ 2017-06-26 09:33 云自無心水自閑 閱讀(411) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 彭泽县| 黔西县| 昌江| 望城县| 中江县| 阿拉善右旗| 灵台县| 海南省| 洮南市| 石屏县| 内黄县| 云浮市| 唐河县| 赤城县| 嵊泗县| 沂南县| 界首市| 绍兴县| 马鞍山市| 高阳县| 苍南县| 安泽县| 临安市| 故城县| 新田县| 库尔勒市| 汉中市| 邓州市| 关岭| 恩施市| 海伦市| 西昌市| 大丰市| 法库县| 渝中区| 克山县| 安阳市| 越西县| 来宾市| 乐至县| 涿鹿县|