Java版本和JVM之间的标记到底在哪里? [英] Where is exactly is the demarkation between a version of Java and the JVM?

查看:107
本文介绍了Java版本和JVM之间的标记到底在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java版本和JVM之间的标记到底在哪里?

Where is exactly is the demarkation between a version of Java and the JVM?

我之所以问是因为最近有一个教育性"注释线程与SOpedian一起讨论了java.io.BufferedInputStream的默认缓冲区大小,我看到的是8192.(一直是8192吗?)仅考虑API时,显然是什么.但是随着java.*类的实现 ...我只是不知道.

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:

  • BufferedInputStream的默认缓冲区大小是否可以在Java版本之间更改?
  • BufferedInputStream的默认缓冲区大小在不同供应商的JVM上是否可以不同?
  • 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.)

推荐答案

由于 BufferedInputStream 的API规范未指定值,完全取决于实现来选择一个值.

Since the API specification of BufferedInputStream doesn't specify a value, it is entirely up to the implementation to choose one.

这意味着默认缓冲区大小可以在Java版本之间以及同一Java规范的不同实现之间进行更改.

This means that the default buffer size can change between Java versions as well as between different implementations of the same Java specification.

在其他方面几乎是相同的:真正的规范是文档(即JLS,JVM规范和API规范,或者相应的JCP).

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.

这篇关于Java版本和JVM之间的标记到底在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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