程序手記

          程序是我畢生的追求......
          隨筆 - 19, 文章 - 0, 評論 - 9, 引用 - 0
          數據加載中……

          JSP基礎 (高級計數器實例) 第二十天

                                                                                     countFile.java
          public class countFile{
              public static void writeFile(String filename,long count){
                  PrintWriter out = new PrintWriter(new FileWriter(filename));
                  out.println(count);
                  out.close();
              }
              public static void readFile(String filename){
                  File f = new File(filename);
                  if(!f.exists()){
                      writeFile(filename,0);
                  }
                  BufferedReader in = new BufferedReader(new FileReader(f));
                  long count = Long.parseLong(in.readline());
                  return count;
              }
              public static String tranform(long count){
                  String countNumber = ""+count;
                  String newstring = "";
                  for(int i=0;i<countNumber.length;i++){
                      newstring+="<img src='images/"+countNumber.charAT(i)+".gif' >";
                  }
                  return newstring;
              }
          }

          posted on 2008-08-20 05:19 程序手記 閱讀(182) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 肥西县| 韶关市| 芒康县| 高雄县| 翁源县| 贺兰县| 玉屏| 满洲里市| 黎川县| 遂溪县| 诏安县| 东安县| 嘉兴市| 古田县| 栾川县| 察雅县| 高唐县| 灌南县| 朔州市| 宝兴县| 荆州市| 海林市| 图木舒克市| 厦门市| 精河县| 广德县| 泽州县| 海林市| 仁化县| 汉寿县| 安西县| 屏南县| 鄂托克旗| 乐清市| 云浮市| 亚东县| 渝北区| 玉门市| 天全县| 茌平县| 新建县|