Dedian  
          -- 關(guān)注搜索引擎的開發(fā)
          日歷
          <2014年12月>
          30123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910
          統(tǒng)計(jì)
          • 隨筆 - 82
          • 文章 - 2
          • 評論 - 228
          • 引用 - 0

          導(dǎo)航

          常用鏈接

          留言簿(8)

          隨筆分類(45)

          隨筆檔案(82)

          文章檔案(2)

          Java Spaces

          搜索

          •  

          積分與排名

          • 積分 - 65550
          • 排名 - 817

          最新評論

          閱讀排行榜

          評論排行榜

           
          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();
          ??? ??? ???
          }

          When I do the socket programming, I always need to deal with inputstream and string, above are the basic ways to so that, but I am not sure if there are any simpler ways to do that...

          posted on 2006-04-29 05:17 Dedian 閱讀(625) 評論(3)  編輯  收藏 所屬分類: Java Memo
          評論:
           
          Copyright © Dedian Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 九龙城区| 泰宁县| 全椒县| 阿尔山市| 定安县| 通州市| 贺兰县| 巴林左旗| 蓬安县| 威宁| 中西区| 泽普县| 潼关县| 夏邑县| 繁峙县| 观塘区| 南安市| 龙陵县| 东安县| 万荣县| 孝感市| 平阳县| 略阳县| 和林格尔县| 义马市| 安西县| 如东县| 磐石市| 古丈县| 江达县| 黑山县| 平遥县| 方山县| 平陆县| 游戏| 筠连县| 炎陵县| 海口市| 上蔡县| 闵行区| 岐山县|