<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Dedian  
    -- 關注搜索引擎的開發
    日歷
    <2006年8月>
    303112345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789
    統計
    • 隨筆 - 82
    • 文章 - 2
    • 評論 - 228
    • 引用 - 0

    導航

    常用鏈接

    留言簿(8)

    隨筆分類(45)

    隨筆檔案(82)

    文章檔案(2)

    Java Spaces

    搜索

    •  

    積分與排名

    • 積分 - 66093
    • 排名 - 813

    最新評論

    閱讀排行榜

    評論排行榜

     
    -- Scenario:
    ??? The purpose of a reader is to interpret a low-level byte stream (ByteArrayInputStream, StringInputStream, FileInputStream and so on) as a character stream and provid character input to whatever class needs it. And it is very simple to convert an inputstream to a reader:
    Reader reader = new InputStreamReader( in ); //in is an instance of class InputStream or derived classes
    But the issue is sometimes we need convert a reader to inputstream, think about following scenaros:
    1.? the original inputstream has been filtered by certian reader, now we need save back filtered content into database by inputstream: we can not use original inputstream but filtered stream which can only get from your reader.
    2.? Given a class who contains a reader to access a streaming content after complex parsering or downloading, we want to utilize the streaming content in this class while not repeating complex operations for content analysis, so we need employ some wrapper methods to get inputstream from reader.

    -- Solution:
    1. write own InputStream implementation, such as following:

    class MyInputStream extends InputStream
    {
    private Reader rd;
    public MyInputStream(Reader rd)
    {
    super();
    this.rd = rd;
    }
    ?
    ?
    // implement the read() method to make this all work
    publicint read()
    {
    int t = rd.read();
    // you can do your processing on the inputReader here
    // fiddle with the values and return
    return t;
    ?
    }
    }
    Note: Applications that need to define a subclass of InputStream must always provide a method that returns the next byte of input.
    (refer to http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html)

    -- anything else? BTW, for parsering xml-based input stream by SAX, I am glad to see that the inputSource constructor can take either InputStream or Reader (refer to http://java.sun.com/j2se/1.4.2/docs/api/org/xml/sax/InputSource.html)


    posted on 2006-08-29 09:46 Dedian 閱讀(1344) 評論(0)  編輯  收藏 所屬分類: Java Glossary
     
    Copyright © Dedian Powered by: 博客園 模板提供:滬江博客
    主站蜘蛛池模板: 亚洲第一页中文字幕| 老色鬼久久亚洲AV综合| 中文字幕无码精品亚洲资源网| 亚洲成a人片在线观看老师| 亚洲性猛交XXXX| 亚洲手机中文字幕| 久久亚洲精品无码av| 巨胸喷奶水www永久免费| 99re在线这里只有精品免费| 亚洲免费网站观看视频| 亚洲国产一级在线观看| 亚洲欧洲国产精品久久| 中文字幕免费视频| 亚洲午夜成人精品电影在线观看| 亚洲Av无码一区二区二三区| a在线视频免费观看在线视频三区| 久久国产精品免费视频| 暖暖在线日本免费中文| 亚洲成人动漫在线| 国产亚洲福利精品一区二区| 一区二区三区四区免费视频 | 人人狠狠综合久久亚洲88| 国产 亚洲 中文在线 字幕| 无遮挡免费一区二区三区| 亚洲人成网站免费播放| 国产亚洲精品美女| 亚洲精品无码永久中文字幕| 国产亚洲福利精品一区二区| 亚洲欧洲成人精品香蕉网| 1000部拍拍拍18勿入免费视频下载 | 国产乱子伦精品免费女 | 亚洲av无码一区二区三区在线播放| 国产成人无码a区在线观看视频免费| 亚洲无成人网77777| 国产免费啪嗒啪嗒视频看看| 久久九九免费高清视频| 亚洲欧洲中文日韩久久AV乱码| 美女在线视频观看影院免费天天看| 亚洲一区精品伊人久久伊人| 色欲国产麻豆一精品一AV一免费 | 五月天婷婷免费视频|