天空是藍色的

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

          主站蜘蛛池模板: 连云港市| 武穴市| 高唐县| 霸州市| 南投市| 利津县| 宁国市| 泰和县| 湖南省| 威远县| 百色市| 襄城县| 肥城市| 杨浦区| 鸡西市| 塘沽区| 贵州省| 府谷县| 蓬溪县| 新丰县| 尚义县| 德昌县| 山东省| 讷河市| 措美县| 朝阳市| 丁青县| 崇明县| 江陵县| 台湾省| 连江县| 达日县| 土默特右旗| 错那县| 东辽县| 奉化市| 明光市| 嘉定区| 广昌县| 珲春市| 高安市|