热门国产精品亚洲第一区在线,国产一区二区三区丝袜,欧美第一视频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 發表評論
]]>
主站蜘蛛池模板: 龙岩市| 汨罗市| 美姑县| 类乌齐县| 孟村| 定陶县| 罗定市| 平昌县| 华阴市| 河西区| 茂名市| 安顺市| 屏山县| 谢通门县| 饶阳县| 明光市| 东港市| 蛟河市| 永安市| 平湖市| 平谷区| 兴文县| 邹城市| 赤峰市| 若羌县| 紫金县| 商都县| 高台县| 惠东县| 张掖市| 靖安县| 苗栗县| 安阳市| 馆陶县| 麻江县| 大同县| 穆棱市| 布拖县| 安宁市| 玉田县| 大兴区|