超越自我

          一切皆有可能

           

          字符串與流的相互轉(zhuǎn)換

          1. String --> InputStream

          InputStream convertToInputStream(String str)
          {
          ??? ??? ByteArrayInputStream is = new ByteArrayInputStream(str.getBytes());
          ??????? return is;
          }

          2. InputStream --> String
          ????
          String convertToString(InputStream is)
          {
          ??? ??
          ?????? BufferedReader in = new BufferedReader(new InputStreamReader(is));
          ??? ??? StringBuffer buffer = new StringBuffer();
          ??? ??? String line = "";
          ??? ??? while ((line = in.readLine()) != null)
          ??? ??? {
          ???? ??? ??? buffer.append(line);
          ???? ??? }
          ???? ??? return buffer.toString();
          ??? ??? ???
          }

          posted on 2006-08-21 14:35 jame 閱讀(337) 評論(0)  編輯  收藏 所屬分類: JAVA基本接口


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


          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

          統(tǒng)計

          常用鏈接

          留言簿(3)

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          UML

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 合作市| 灵石县| 宜都市| 运城市| 灌阳县| 绥化市| 阳春市| 元阳县| 房产| 德惠市| 醴陵市| 泸定县| 宜良县| 水城县| 雷州市| 樟树市| 兴城市| 繁峙县| 东乡族自治县| 扶余县| 武威市| 文山县| 钦州市| 连云港市| 阳西县| 宣化县| 余庆县| 乌兰察布市| 西城区| 通许县| 旬阳县| 汪清县| 清徐县| 丽水市| 富源县| 巴中市| 清水河县| 尼木县| 石林| 阳泉市| 石楼县|