Where is exactly is the demarkation between a version of Java and the JVM?
I’m asking because of a recent ‘educational’ comment thread with a fellow SOpedian regarding the default buffer size of java.io.BufferedInputStream, which I see is 8192. (Has it always been 8192?) When thinking about just the API, it is clear to be what is what. But with the implementation of a java.* class…I just don’t know.
This leads to two derivative questions:
- Could
BufferedInputStream‘s default buffer size change between versions of Java? - Could
BufferedInputStream‘s default buffer size be different on various vendor’s JVMs?
(Surely there are other similar examples, like in the implementation of various collections.)
Since the API specification of
BufferedInputStreamdoesn’t specify a value, it is entirely up to the implementation to choose one.This means that the default buffer size can change between Java versions as well as between different implementations of the same Java specification.
It’s pretty much the same in other areas: the real specification is the documentation (i.e. JLS, JVM Specification and API specification, or rather the corresponding JCPs).
Everything else (i.e. everything you can see from looking at the source) is an implementation detail and depending on it is a bug.