JAVA 7 正式版發布 新特性一覽表

openkk 13年前發布 | 29K 次閱讀 Java7

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).

目錄 /sample/nio/chatserver/ 包含使用 java.nio.file 包的演示程序。

目錄 /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

目錄/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

目錄 /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

 本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!