<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Java && C#

    要學(xué)得東西很多,但我們的時間卻不是很多!
    數(shù)據(jù)加載中……

    2007年3月27日

    點(diǎn)點(diǎn)滴滴

         N長時間沒有來了.......
         忙中偷閑,整理點(diǎn)代碼。
         /** 
         *  復(fù)制單個文件 
         *  @param  oldPath  String  原文件路徑  如:c:/fqf.txt 
         *  @param  newPath  String  復(fù)制后路徑  如:f:/fqf.txt 
         *  @return  boolean 
         */ 
       public  void  copyFile(String  oldPath,  String  newPath) 
       { 
           try  { 
               int  bytesum  =  0; 
               int  byteread  =  0; 
               File  oldfile  =  new  File(oldPath); 
               if  (oldfile.exists())  {  //文件存在時 
                   InputStream  inStream  =  new  FileInputStream(oldPath);  //讀入原文件 
                   FileOutputStream  fs  =  new  FileOutputStream(newPath); 
                   byte[]  buffer  =  new  byte[1444]; 
                   int  length; 
                   while  (  (byteread  =  inStream.read(buffer))  !=  -1)  { 
                       bytesum  +=  byteread;  //字節(jié)數(shù)  文件大小 
                       System.out.println(bytesum); 
                       fs.write(buffer,  0,  byteread); 
                   } 
                   inStream.close(); 
               } 
           } 
           catch  (Exception  e)  { 
               System.out.println("復(fù)制單個文件操作出錯"); 
               e.printStackTrace();  
           }  
       }  

    //保存文件的方法
    public String Savefiles(FormFile file,String path)
     {  
      String fileName= file.getFileName();
      String contentType = file.getContentType();
      String size = (file.getFileSize() + " bytes");
      try
      {
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       InputStream stream = file.getInputStream();
       OutputStream bos = new FileOutputStream(path+fileName);
       int bytesRead = 0;
       byte[] buffer = new byte[8192];
       while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
        bos.write(buffer, 0, bytesRead);
       }
       bos.close();      
       stream.close();  
      }
      catch (IOException e) {
       return e.getMessage();
      }
      return "1";
     }

    //生成15位的字符串
    public String GenTradeId()
     {
      String tradeId = "";
      RandomStrg.setCharset("a-zA-Z0-9");  
      RandomStrg.setLength("15");  
      try
      {
       RandomStrg.generateRandomObject();
       tradeId=RandomStrg.getRandom();   
      }
      catch (Exception e)
      {    
      }
      return tradeId;  
     }

    /**
      * 刪除字符串中的空格,至多只保留一個空格
      * 
      * @String txt:輸入需要處理的字符串
      * @return String :返回處理后的字符串
      * 
      */
     public String deleteWhitespace(String txt){
      if((txt!=null)&&(txt.trim().length()>1)){
       
      }
      else{
       return "";
      }
      
      txt = txt.replaceAll("\n"," ").replaceAll("\t"," ");
      String temp="";
      try{
       int flag =0,num=0;
       char c = 'x';
       StringBuffer sb = new StringBuffer("");
       for(int x=0;x<txt.length();x++){
        c = txt.charAt(x);
        if((c==' ')&&(flag==0)){
         sb.append(c);
         flag =1;
        }
        else if((c!=' ')){
         sb.append(c);
         flag =0;
        }
       }
       temp = sb.toString().trim();
      }
      catch(Exception e){
       ;
      }
      return temp;
     }

    posted @ 2007-08-08 11:03 Bill111 閱讀(1534) | 評論 (0)編輯 收藏
    JavaScript Example

         摘要: 1.文本框焦點(diǎn)問題onBlur:當(dāng)失去輸入焦點(diǎn)后產(chǎn)生該事件onFocus:當(dāng)輸入獲得焦點(diǎn)后,產(chǎn)生該文件Onchange:當(dāng)文字值改變時,產(chǎn)生該事件Onselect:當(dāng)文字加亮后,產(chǎn)生該文件 <input type="text" value="郭強(qiáng)" onfocus="if(value=='郭強(qiáng)') {value=''}" onblur="if (value=='')...  閱讀全文

    posted @ 2007-03-27 17:18 Bill111 閱讀(2249) | 評論 (0)編輯 收藏
    主站蜘蛛池模板: 亚洲日本va中文字幕久久| 亚洲精品黄色视频在线观看免费资源 | 在线jlzzjlzz免费播放| 亚洲免费视频播放| 一二三四影视在线看片免费| 亚洲国产成人久久三区| 啦啦啦高清视频在线观看免费 | 午夜免费不卡毛片完整版| 亚洲国产成人久久一区WWW| 久久人午夜亚洲精品无码区| 国产jizzjizz视频全部免费| 久久精品国产亚洲麻豆| 久久精品乱子伦免费| 日本成人免费在线| 国产精品亚洲精品日韩电影| xvideos亚洲永久网址| 久久国产精品免费一区| 亚洲嫩草影院久久精品| 亚洲一级毛片免费看| 亚洲中文字幕无码爆乳app| 国产亚洲精品免费| 国产免费久久久久久无码| 亚洲精品自产拍在线观看动漫| 亚洲一级免费视频| 亚洲精品乱码久久久久蜜桃| 亚洲Av无码乱码在线观看性色 | 天天影院成人免费观看| 亚洲日本va一区二区三区| 亚洲人成人无码网www国产| 亚洲综合一区二区三区四区五区| 国产免费黄色大片| 国产一级一毛免费黄片| 亚洲人成网站18禁止久久影院| 免费视频中文字幕| 国产精品免费无遮挡无码永久视频| 亚洲精品国产福利在线观看| 182tv免费视频在线观看| 亚洲国产成AV人天堂无码| 成人亚洲综合天堂| 国产成人精品免费午夜app| 国产成人综合亚洲一区|