天空是藍色的

          做好軟件為中國 #gcc -c helloworld.c -o helloworld.o //編譯目標文件 #gcc helloworld.o -o helloworld //編譯成可執行exe #helloworld //運行exe
          數據加載中……
          IO讀取文件編碼是utf-8的文件

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

          public class ReadFile {
          ???????public static void main(String[] args) throws IOException{
          ??????????????File file = new File("D:\\test.txt");
          ??????????????FileReader fileReader = new FileReader(file);
          ??????????????String sx = fileReader.getEncoding();
          ??????????????FileInputStream fileInputStream = new FileInputStream(file);
          ??????????????InputStreamReader inputStramReader = new InputStreamReader(fileInputStream, "utf-8");
          ??????????????BufferedReader bufferedReader = new BufferedReader(inputStramReader);
          ??????????????String fileContent = "";
          ??????????????String line = null;
          ??????????????while ((line = bufferedReader.readLine()) != null) {
          ?????????????????????fileContent += line + "\n";
          ??????????????}
          ???????}

          }

          posted on 2005-11-07 15:51 bluesky 閱讀(2649) 評論(0)  編輯  收藏 所屬分類: 基礎知識

          主站蜘蛛池模板: 洛川县| 益阳市| 大石桥市| 冷水江市| 兴安县| 胶州市| 潞城市| 岑溪市| 务川| 海宁市| 抚州市| 攀枝花市| 北辰区| 哈尔滨市| 登封市| 衡山县| 元谋县| 措美县| 郁南县| 四川省| 旺苍县| 吉安县| 兴城市| 武陟县| 长武县| 广州市| 咸宁市| 合肥市| 察哈| 西吉县| 五大连池市| 抚顺县| 宁明县| 东乌珠穆沁旗| 醴陵市| 陇川县| 微博| 茌平县| 伊宁县| 花莲市| 安徽省|