Java 7 的新特性一览表打赏

官方已经在去年7月28发布了Java7,最近小子开始研究Java了,将其新特性搜集整理出来以供参考。

Java 7 的架构图:

新特性一览表:

Swing

  • 新增 JLayer 类,是一个灵活而且功能强大的Swing组件修饰器,使用方法:How to Decorate Components with JLayer.
  • Nimbus Look and Feel 外观从 com.sun.java.swing 包移到 javax.swing 包中,详情:javax.swing.plaf.nimbus
  • 更轻松的重量级和轻量级组件的混合
  • 支持透明窗体以及非矩形窗体的图形界面,请看 How to Create Translucent and Shaped Windows
  • JColorChooser 类新增 HSV tab.


网络

  • 新增 URLClassLoader.close 方法,请看 Closing a URLClassLoader.
  • 支持 Sockets Direct Protocol (SDP) 提供高性能网络连接,详情请看 Understanding the Sockets Direct Protocol.


集合

  • 新增 TransferQueue 接口,是 BlockingQueue 的改进版,实现类为 LinkedTransferQueue


RIA/
发布

  • 拖拽的小程序使用一个默认或者定制的标题进行修饰,详情:Requesting and Customizing Applet Decoration in Draggable Applets.
  • JNLP 文件做了如下方面的增强,详情请看 JNLP File Syntax:
    • The os attribute in the information and resources elements can now contain specific versions of Windows, such as Windows Vista or Windows 7.
    • Applications can use the install attribute in the shortcut element to specify their their desire to be installed. Installed applications are not removed when the Java Web Start cache is cleared, but can be explicitly removed using the Java Control Panel.
    • Java Web Start applications can be deployed without specifying the codebaseattribute; see Deploying Without Codebase
  • 可直接在 HTML 中嵌入 JNLP 文件:Embedding JNLP File in Applet Tag.
  • 可在 JavaScript 代码中检查 Applet 是否已经加载完成:Handling Initialization Status With Event Handlers.
  • 可在 Applet 从快捷方式启动或者拖出浏览器时对窗口样式和标题进行控制:Requesting and Customizing Applet Decoration in Developing Draggable Applets.


XML

  • 包含 Java API for XML Processing (JAXP) 1.4.5, 支持 Java Architecture for XML Binding(JAXB) 2.2.3, 和 Java API for XML Web Services (JAX-WS) 2.2.4.


java.lang

  • 消除了在多线程环境下的非层次话类加载时导致的潜在死锁,详情:Multithreaded Custom Class Loaders in Java SE 7.


Java
虚拟机

  • 支持非 Java 语言: Java SE 7 引入一个新的 JVM 指令用于简化实现动态类型编程语言
  • Garbage-First Collector 是一个服务器端的垃圾收集器用于替换 Concurrent Mark-Sweep Collector (CMS).
  • 提升了 Java HotSpot 虚拟机的性能


Java I/O

java.nio.file 包以及相关的包 java.nio.file.attribute 提供对文件 I/O 以及访问文件系统的全面支持,请看 File I/O (featuring NIO.2).

  • 目录 <Java home>/sample/nio/chatserver/ 包含使用 java.nio.file 包的演示程序
  • 目录 <Java home>/demo/nio/zipfs/ 包含 NIO.2 NFS 文件系统的演示程序


安全性

  • 新的内置对多个基于 ECC 算法(ECDSA/ECDH)的支持,详情请看:Sun PKCS#11 Provider's Supported Algorithms in Java PKCS#11 Reference Guide.
  • 禁用了一些弱加密算法,详情请看 Appendix D: Disabling Cryptographic Algorithms in Java PKI Programmer's Guide and Disabled Cryptographic Algorithms in Java Secure Socket Extension (JSSE) Reference Guide.
  • Java 安全套接字扩展中对 SSL/TLS 的增强


并发

  • fork/join 框架,基于 ForkJoinPool 类,是 Executor 接口的实现,设计它用来进行高效的运行大量任务;使用 work-stealing 技术用来保证大量的 worker 线程工作,特别适合多处理器环境,详情请看 Fork/Join
    • 目录<Java home>/sample/forkjoin/ 包含了 fork/join 框架的演示程序
  • ThreadLocalRandom 类class 消除了使用伪随机码线程的竞争,请看 Concurrent Random Numbers.
  • Phaser 类是一个新的同步的屏障,与 CyclicBarrier 类似.


Java 2D

  • 一个新的基于 XRender 的 Java 2D 渲染管道支持现在的 X11 桌面,改善了图形性能,请看 System Properties for Java 2D Technology 中的 xrender .
  • JDK 可枚举并显示出已安装的 OpenType/CFF 字体,通过GraphicsEnvironment.getAvailableFontFamilyNames 方法 See Selecting a Font.
  • TextLayout 类支持西藏语脚本
  • libfontconfig, 是一个字体配置 api ,see Fontconfig.


国际化

  • 支持 Unicode 6.0.0
    • 目录 <Java home>/demo/jfc/Font2DTest/ 包含 Unicode 6.0 的演示程序
    • Java SE 7 可容纳在 ISO 4217 中新的货币,详情请看 Currency 类.


Java
编程语言特性

  • 二进制数字表达方式
  • 使用下划线对数字进行分隔表达,例如 1_322_222
  • switch 语句支持字符串变量
  • 泛型实例创建的类型推断
  • 使用可变参数时,提升编译器的警告和错误信息
  • try-with-resources 语句
  • 同时捕获多个异常处理


JDBC 4.1

  • 支持使用 try-with-resources 语句进行自动的资源释放,包括连接、语句和结果集
  • 支持 RowSet 1.1
Java 7 的新特性一览表
文章《Java 7 的新特性一览表》二维码
  • 微信打赏
  • 支付宝打赏

已有1条评论

  1. 超能小女神

    [yes]

    2015-10-03 00:13 回复

(必填)

(必填)

(可选)