Dedian  
          -- 關(guān)注搜索引擎的開發(fā)
          日歷
          <2006年4月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456
          統(tǒng)計
          • 隨筆 - 82
          • 文章 - 2
          • 評論 - 228
          • 引用 - 0

          導(dǎo)航

          常用鏈接

          留言簿(8)

          隨筆分類(45)

          隨筆檔案(82)

          文章檔案(2)

          Java Spaces

          搜索

          •  

          積分與排名

          • 積分 - 65598
          • 排名 - 816

          最新評論

          閱讀排行榜

          評論排行榜

           
          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 閱讀(626) 評論(3)  編輯  收藏 所屬分類: Java Memo
          評論:
           
          Copyright © Dedian Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 沧州市| 潍坊市| 隆林| 太康县| 台江县| 霍林郭勒市| 浏阳市| 安龙县| 民丰县| 韩城市| 邹平县| 华安县| 图木舒克市| 泰州市| 韩城市| 拉孜县| 通化县| 广州市| 含山县| 梓潼县| 如东县| 丰原市| 六安市| 柳州市| 嘉黎县| 沁水县| 黎川县| 阳朔县| 双峰县| 额济纳旗| 集贤县| 德清县| 苍梧县| 雷州市| 新沂市| 南丰县| 历史| 盐边县| 扎鲁特旗| 江永县| 中卫市|