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

          導(dǎo)航

          常用鏈接

          留言簿(8)

          隨筆分類(45)

          隨筆檔案(82)

          文章檔案(2)

          Java Spaces

          搜索

          •  

          積分與排名

          • 積分 - 66094
          • 排名 - 813

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

           
          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 閱讀(631) 評(píng)論(3)  編輯  收藏 所屬分類: Java Memo
          評(píng)論:
           
          Copyright © Dedian Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 白城市| 海城市| 黄石市| 浠水县| 永春县| 临夏县| 汉阴县| 灌南县| 黄梅县| 阿克| 莎车县| 兰溪市| 无为县| 岳阳市| 监利县| 武义县| 盐城市| 甘德县| 固安县| 灵台县| 百色市| 虞城县| 宁城县| 沐川县| 三穗县| 平湖市| 黄陵县| 怀远县| 东港市| 大渡口区| 许昌市| 务川| 聂拉木县| 锡林郭勒盟| 塔城市| 阜平县| 息烽县| 宾川县| 昭觉县| 西贡区| 香港 |