FileInputStream是否有一个内部缓冲区 [英] Does FileInputStream have an internal buffer

查看:207
本文介绍了FileInputStream是否有一个内部缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个的问题包括以下对(对我来说)断言


Java和Perl都很难当在文件中读取时,找到所有默认的缓冲区大小


Javadoc for FileInputStream 然而,提及具有自己的缓冲区的类。为什么它,因为有一个 BufferedInputStream 类?类 FileInputStream 的对象是否有自己的缓冲区?我意识到,操作系统本身将有缓冲区;我没有问这些。

解决方案

你提到的SO问题特别针对 InputStreamReader BufferedReader ,而不是您所谈论的流类。它甚至提到了BufferedReader的默认缓冲区大小。



我知道这是一个很长的帖子,但是你应该阅读它,而不是在阅读第一个问题为了给你一个答案,看看提供的链接,显然不是。 / p>

This question includes the following surpising (to me) assertion

both Java and Perl try quite hard to find a one-size-fits all default buffer size when reading in files

The Javadoc for FileInputStream however makes no mention of the class having its own buffer. And why should it, given that there is a BufferedInputStream class? Do objects of class FileInputStream have their own buffer? I realize that the O/S itself will have buffers; I'm not asking about those.

解决方案

The SO question you mention deals specifically with InputStreamReader and BufferedReader instead of *Stream classes you talk about. It even mentions the default buffer size of BufferedReader.

I know it is a long post, but you should read it all instead of forking it to another question after reading its first sentence.

To give you an answer, looking at the link provided by Matt Ball, apparently not.

这篇关于FileInputStream是否有一个内部缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆