旧的和外来的JVM上java.io.BufferedInputStream的默认缓冲区大小是多少? [英] What are the default buffer size for java.io.BufferedInputStream on old and exotic JVMs?

查看:489
本文介绍了旧的和外来的JVM上java.io.BufferedInputStream的默认缓冲区大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究有关 java.io.BufferedInputStream 和缓冲区的博客文章。显然,这些年来,Sun的Java 7实现的默认值从(大概是) 从512字节增长到了8192字节,甚至在 JDK 1.1.8中的JavaDoc 。我的问题还提出了谁/什么决定默认值应该是什么 –它不像我期望的那样黑/白。

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.

我很好奇每个版本的默认缓冲区大小是多少,以及其他奇特的JVM中的默认大小。到目前为止,我已经通过源代码,JavaDocs或针对1.0、1.1、1.4,Java 5,Java 6和(可能是再次) Sun的Java 7 JVM的Sun错误报告进行了跟踪。

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.

我未能提供的是这个值


  • Sun JDK 1.2' s JVM实现

  • Sun JDK 1.3的实现

  • 其他任何实现的价值(例如IBM或其他)

所以,我想知道这些值是什么以及在哪里可以找到它们的引用?

或者,如果那里有任何SOpedians,那霸气可能就可以使用这些装置之一。如果是这样,您可以编译并运行以下代码,然后在此处进行报告吗?或者,您是否知道

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,苹果提供的默认VM:

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)

然后:

1.6.0_26
8192

这篇关于旧的和外来的JVM上java.io.BufferedInputStream的默认缓冲区大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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