Java默认缓冲,旧的和外来的JVM上java.io.BufferedInputStream的默认缓冲区大小是多少?...

I've been doing some research for a blog post regarding java.io.BufferedInputStream and buffers. Apparently, over the years, the default has grown from a measly 512 bytes to 8192 bytes as of (presumptuously) Sun's Java 7 implementation, and was even explicitly specified in the JavaDocs in JDK 1.1.8. My question has also brought up questions of who/what deciedes what the default should be--it's not as black-n-white as I had expected.

I am curious as to what the default buffer size has been at each version release, and what it may be in other, exotic JVMs. So far I've tracked it down, via source code, JavaDocs or Sun bug reports for 1.0, 1.1, 1.4, Java 5, Java 6 and (presumptuously again) Sun's Java 7 JVM.

What I've failed to turn up is this value for

Sun JDK 1.2's JVM implementation

Sun JDK 1.3's implementation

Any other implementation's value (like IBM or something else)

So, I was wondering what those values are and where I could find a reference to them?

Or, that baring, if any SOpedians out there might have access to one of these installations. If so, could you compile and run the below code, and then report back here? Or, do you know of

import java.io.BufferedInputStream;

import java.io.InputStream;

public class BufferSizeDetector extends BufferedInputStream {

public static void main(String[] args) {

BufferSizeDetector bsd = new BufferSizeDetector(null);

System.err.println(System.getProperty("java.version"));

System.err.println(bsd.getBufferSize());

}

public BufferSizeDetector(InputStream in) {

super(in);

}

public int getBufferSize() {

return super.buf.length;

}

}

解决方案

Mac OS X Tiger 10.7.0, default Apple-provided VM:

Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511)

Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)

Then:

1.6.0_26

8192

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值