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

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

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

    Calvin's Tech Space

    成于堅忍,毀于浮躁

       :: 首頁 :: 聯系 :: 聚合  :: 管理
    首先這個方法不能用來判斷文件長度!獲取文件長度可以使用File.length()方法,它返回一個long類型的以字節為單位的值。

    看文檔:
    Returns an estimated number of bytes that can be read or skipped without blocking for more input.

    Note that this method provides such a weak guarantee that it is not very useful in practice.

    Firstly, the guarantee is "without blocking for more input" rather than "without blocking": a read may still block waiting for I/O to complete — the guarantee is merely that it won't have to wait indefinitely for data to be written. The result of this method should not be used as a license to do I/O on a thread that shouldn't be blocked.

    Secondly, the result is a conservative estimate and may be significantly smaller than the actual number of bytes available. In particular, an implementation that always returns 0 would be correct. In general, callers should only use this method if they'd be satisfied with treating the result as a boolean yes or no answer to the question "is there definitely data ready?".

    Thirdly, the fact that a given number of bytes is "available" does not guarantee that a read or skip will actually read or skip that many bytes: they may read or skip fewer.

    It is particularly important to realize that you must not use this method to size a container and assume that you can read the entirety of the stream without needing to resize the container. Such callers should probably write everything they read to a ByteArrayOutputStream and convert that to a byte array. Alternatively, if you're reading from a file, length() returns the current length of the file (though assuming the file's length can't change may be incorrect, reading a file is inherently racy).

    The default implementation of this method in InputStream always returns 0. Subclasses should override this method if they are able to indicate the number of bytes available.

    posted on 2011-11-18 14:16 calvin 閱讀(1261) 評論(0)  編輯  收藏 所屬分類: Java
    主站蜘蛛池模板: 精品免费国产一区二区| 色婷婷六月亚洲婷婷丁香| 中国一级毛片免费看视频| 亚洲AV无码一区东京热久久| 最近的免费中文字幕视频| 一区二区三区免费在线观看| 亚洲精品电影天堂网| 四虎影视精品永久免费网站| 久久精品国产免费一区| 亚洲精品无播放器在线播放| 亚洲精品午夜无码电影网| 99久久免费精品国产72精品九九| 国产免费一区二区三区免费视频 | 亚洲电影在线播放| 国产美女无遮挡免费视频| 久久久久国产免费| 免费看黄网站在线看| 亚洲嫩草影院在线观看| 亚洲国产精品成人久久蜜臀 | 亚洲国产精华液网站w| 好先生在线观看免费播放 | 亚洲无码精品浪潮| 国产片AV片永久免费观看| 国产精品99爱免费视频| 亚洲综合在线一区二区三区| 亚洲成AV人片在线观看WWW| 国产在线观看免费不卡| 1000部国产成人免费视频| 中文字幕乱码系列免费| 亚洲av日韩综合一区二区三区| 亚洲午夜在线电影| 亚洲一区视频在线播放| 日韩免费视频播播| 欧美在线看片A免费观看| 日本免费中文字幕| 丝袜捆绑调教视频免费区| 特黄aa级毛片免费视频播放| 精品国产成人亚洲午夜福利| 亚洲高清中文字幕| 久久精品国产亚洲| 国产亚洲精品xxx|