热门国产精品亚洲第一区在线,国产一区二区三区丝袜,欧美第一视频http://www.aygfsteel.com/stevenjohn/category/51107.html那些青春的歲月zh-cnSat, 21 Sep 2013 08:56:54 GMTSat, 21 Sep 2013 08:56:54 GMT60Java 下載文件http://www.aygfsteel.com/stevenjohn/archive/2013/09/21/404264.htmlabinabinSat, 21 Sep 2013 08:06:00 GMThttp://www.aygfsteel.com/stevenjohn/archive/2013/09/21/404264.htmlhttp://www.aygfsteel.com/stevenjohn/comments/404264.htmlhttp://www.aygfsteel.com/stevenjohn/archive/2013/09/21/404264.html#Feedback0http://www.aygfsteel.com/stevenjohn/comments/commentRss/404264.htmlhttp://www.aygfsteel.com/stevenjohn/services/trackbacks/404264.html
   try {
            response.setContentType("application/vnd.ms-excel;charset=UTF-8");
            response.setHeader("Content-Disposition", "attachment; filename=" +teamQuery.getTeamId()+ new String(" 項目銷量.xls".getBytes("gbk"), "iso8859-1"));
            Boolean flag = manteamService.downFile(teamQuery,response.getOutputStream());
            if (flag) {
                resutMap.put("success", true);

            }

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
一定要有response.getOutputStream()


abin 2013-09-21 16:06 發表評論
]]>
統計某一目錄下每個文件中出現的字母個數、數字個數、空格個數及行數(JAVA) http://www.aygfsteel.com/stevenjohn/archive/2012/03/31/373167.htmlabinabinSat, 31 Mar 2012 14:02:00 GMThttp://www.aygfsteel.com/stevenjohn/archive/2012/03/31/373167.htmlhttp://www.aygfsteel.com/stevenjohn/comments/373167.htmlhttp://www.aygfsteel.com/stevenjohn/archive/2012/03/31/373167.html#Feedback0http://www.aygfsteel.com/stevenjohn/comments/commentRss/373167.htmlhttp://www.aygfsteel.com/stevenjohn/services/trackbacks/373167.htmlpackage com.abin.lee.test;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

public class FileTotal {
 
 public static void ReadSubdirectory(File dir){
  if(dir.isDirectory()){
   File[] subFile=dir.listFiles();
   for(int i=0;i<subFile.length;i++){
    if(subFile[i].isDirectory()){
     ReadSubdirectory(subFile[i]);
    }else{
     ReadSubFile(subFile[i]);
    }
   }
  }
 }
 public static void ReadSubFile(File file){
  int numCount=0;
  int letterCount=0;
  int spaceCount=0;
  int lineCount=0;
  int temp=0;
  try {
   FileInputStream input=new FileInputStream(file);
   while((temp=input.read())!=-1){
    if(temp>=48&&temp<=57){
     numCount++;
    }else if((temp>=65&&temp<=90)||(temp>97&&temp<122)){
     letterCount++;
    }else if(temp==32){
     spaceCount++;
    }
   }
   BufferedReader buffer=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
   while(buffer.readLine()!=null){
    lineCount++;
   }
   System.out.println("文件路徑:"+file.getAbsolutePath());
   System.out.println("數字個數:"+numCount);
   System.out.println("字母個數:"+letterCount);
   System.out.println("空格個數:"+spaceCount);
   System.out.println("行數數:"+lineCount);
   
  } catch (Exception e) {
   e.printStackTrace();
  }
 }
 public static void main(String[] args) {
  ReadSubdirectory(new File("D://image"));
 }
}



abin 2012-03-31 22:02 發表評論
]]>
主站蜘蛛池模板: 台北市| 桃江县| 枝江市| 化德县| 金川县| 兴安县| 景东| 长沙县| 根河市| 永福县| 南部县| 区。| 安福县| 平远县| 腾冲县| 策勒县| 仙居县| 旌德县| 台州市| 天津市| 正蓝旗| 金秀| 体育| 乌鲁木齐县| 苍山县| 兖州市| 新乐市| 互助| 高密市| 景宁| 常宁市| 久治县| 邵东县| 康定县| 女性| 邵武市| 蓬安县| 都匀市| 凤翔县| 丽江市| 甘泉县|