chenjinlong

          2010年11月12日 #

          文件加密解密

          /**加密
            *
            */
           public static String doEncrypt(String xmlStr) {
            try {
             return URLEncoder.encode(xmlStr, "GBK");
            } catch (UnsupportedEncodingException e) {
             e.printStackTrace();
            }
            return "加密錯誤";
           }

           /**
            * 解密
            * @param saveFile
            */
           public static void decrypt(File saveFile) {
            try {
             BufferedReader reader = null;
                   reader = new BufferedReader(new FileReader(saveFile));
                   String tempString = null;
                   String str2 =null;
                   while ((tempString = reader.readLine()) != null) {
                    str2=URLDecoder.decode(tempString);
                   }
             FileOutputStream fos = new FileOutputStream(saveFile);
             fos.write(str2.getBytes());
             fos.close();
                   reader.close();
           
            } catch (IOException e) {
             e.printStackTrace();
            }
           }
           
           
           public static void main(String[] args) throws UnsupportedEncodingException {
            
            System.out.println(URLDecoder.decode("C:\\Documents and Settings\\chenchangqing\\Desktop\\實物轉移_20110824030821.xml", "GBK"));
           }




          這是把文件內容轉換成字符的方式

          posted @ 2011-08-26 11:49 chenjinlong 閱讀(191) | 評論 (0)編輯 收藏

          smartupload.jar 實現文件上傳下載

               摘要: 前臺: <form action="uploadimage.jsp" method="post" enctype="multipart/form-data" name="form1"> <input type="file" name="file"> <input type="submit"&n...  閱讀全文

          posted @ 2010-11-12 20:44 chenjinlong 閱讀(1872) | 評論 (0)編輯 收藏

          My Links

          Blog Stats

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 双柏县| 浪卡子县| 嵊泗县| 玉溪市| 修文县| 普陀区| 灌阳县| 蓬安县| 康保县| 沂南县| 桂林市| 祥云县| 玉田县| 长春市| 呼玛县| 宣城市| 莱芜市| 宁德市| 安丘市| 旌德县| 东港市| 兴安盟| 闻喜县| 大埔区| 温泉县| 莱西市| 南康市| 盈江县| 海盐县| 聂荣县| 巢湖市| 小金县| 绥化市| 红安县| 游戏| 吉林市| 云阳县| 左云县| 通榆县| 成武县| 京山县|