天空是藍色的

          做好軟件為中國 #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 閱讀(2654) 評論(0)  編輯  收藏 所屬分類: 基礎知識

          主站蜘蛛池模板: 巴林右旗| 兴业县| 沙洋县| 朝阳市| 城市| 西充县| 交口县| 广水市| 商南县| 新民市| 嘉禾县| 谢通门县| 交口县| 松滋市| 衡阳市| 班戈县| 建水县| 黑山县| 清流县| 高碑店市| 盐亭县| 曲阜市| 梧州市| 临沭县| 宝清县| 和静县| 蒙自县| 平顶山市| 高邮市| 务川| 广汉市| 乳山市| 德江县| 大庆市| 同心县| 伊川县| 巴青县| 翼城县| 丹阳市| 瑞金市| 韶山市|