What are the default buffer size for java.io.BufferedInputStream on old and exotic JVMs?
Asked Answered
S

4

20

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;
    }
}
Stavro answered 19/1, 2010 at 17:0 Comment(4)
This should be marked as Community Wiki. Besides, you can just download archived Sun JDK releases here: java.sun.com/products/archiveIgor
Yes, but that is lots of work...I'm on a Mac and would end up kicking off EC2 instances, installing the JVM, yada, yada, yada. (I'm lazy that way.)Stavro
Community Wiki? This is just a request to collaboration, not a question.Igor
It's a question for very specialized knowledge, or shows someone how to get it. Do you know what these values are? Or where to find them? It's a real question, with a proper question mark and all. Regardless, I've edited the question to appease your delicate sensibilities.Stavro
P
5

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
Postnasal answered 11/8, 2011 at 16:36 Comment(0)
W
4

The system:

Linux wart 2.6.33-rc1-00225-gc9f937e #2 Wed Dec 23 17:55:01 UTC 2009 armv5tel GNU/Linux
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu10)
OpenJDK Core VM (build 14.0-b08, interpreted mode)

The output from your program:

1.6.0_0
8192
Wardmote answered 19/1, 2010 at 21:23 Comment(0)
T
2

I'm not sure what you hope to learn from this, but since I have it in front of me... a win32 IBM 1.4.2 JRE uses a buffer size of 2048.

Tourism answered 19/1, 2010 at 17:24 Comment(1)
Excellent. Thanks. (Are you still coding to 1.4? Ouch.)Stavro
B
1

Run from my IntelliJ in Windows 7:

  • JRE: 1.8.0_112-release-724-b6 amd64
  • JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
  • Windows 7 6.1

Output:

1.8.0_121
8192
Basaltware answered 10/3, 2017 at 4:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.