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

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

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

    Java && C#

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

    2007年3月27日

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

         N長(zhǎng)時(shí)間沒(méi)有來(lái)了.......
         忙中偷閑,整理點(diǎn)代碼。
         /** 
         *  復(fù)制單個(gè)文件 
         *  @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())  {  //文件存在時(shí) 
                   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ù)制單個(gè)文件操作出錯(cuò)"); 
               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;  
     }

    /**
      * 刪除字符串中的空格,至多只保留一個(gè)空格
      * 
      * @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 閱讀(1536) | 評(píng)論 (0)編輯 收藏
    JavaScript Example

         摘要: 1.文本框焦點(diǎn)問(wèn)題onBlur:當(dāng)失去輸入焦點(diǎn)后產(chǎn)生該事件onFocus:當(dāng)輸入獲得焦點(diǎn)后,產(chǎn)生該文件Onchange:當(dāng)文字值改變時(shí),產(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 閱讀(2254) | 評(píng)論 (0)編輯 收藏
    主站蜘蛛池模板: 国产成人无码免费网站| 美女视频黄免费亚洲| 日本一区二区三区免费高清在线 | 91亚洲精品视频| 久久久久久AV无码免费网站| 亚洲精品无码av人在线观看| 成全在线观看免费观看大全| 亚洲精品成人片在线观看精品字幕| 久久久久女教师免费一区| 亚洲一区二区三区偷拍女厕| 国产精品1024在线永久免费 | 精品国产麻豆免费人成网站| 亚洲AV永久无码区成人网站| 久久久久国产精品免费看| 一区二区三区亚洲| 国产精品久久免费| 亚洲中文字幕乱码一区| 免费一级e一片在线播放| 乱人伦中文视频在线观看免费| 国产精品亚洲高清一区二区 | 亚洲天堂2016| 女人18毛片水真多免费看| 亚洲成a人片在线不卡一二三区 | 亚洲成a人片在线播放| 亚洲精品黄色视频在线观看免费资源| 亚洲午夜福利在线观看| 午夜影院免费观看| 亚洲国产视频久久| 亚洲成av人片一区二区三区| 91成人免费福利网站在线| 亚洲色图.com| 四虎影视免费永久在线观看| 最新久久免费视频| 亚洲国产成人久久77| 亚洲AV无码一区二区三区在线观看| 成人久久免费网站| 亚洲人成网站色在线观看| 久久亚洲国产精品五月天婷| 国产电影午夜成年免费视频| 黄网站色成年片大免费高清| 精品日韩亚洲AV无码|