站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.4.0, Java 2 SDK 英文文档

NIO 1.4 RC Changes - JDK 5 Documentation v1.4.0, Java 2 SDK 英文文档

Java

NIO APIs:
1.4 RC Changes

New I/O APIs
This document describes how the NIO APIs in the RC release of J2SE v 1.4 differ from those in Beta 3. The changes are summarized by area:

Buffers

  • Revised the type-specific buffer classes (ByteBuffer, CharBuffer, etc.) to implement the Comparable interface. They already defined the necessary compareTo methods.

  • Revised the type-specific buffer classes to make it impossible to access the backing array of a non-direct heap buffer. Invoking the hasArray method of such a buffer will always return false. Invoking the array or arrayOffset methods of such a buffer will cause a ReadOnlyBufferException to be thrown.

Channels (general)

File channels

  • Revised the transferTo and transferFrom methods to take long rather than int count parameters, and to return long rather than int byte counts, so that they can be used to transfer large files. Revised the map method's size parameter to be long rather than int for consistency.

Other

The changes described in this section were made in the 1.4 RC release but not described in this document until the 1.4 FCS release. For further details, see the JSR-51 Change Log.

  • Added a security check to the CharsetProvider constructor. We defined a new runtime security permission, charsetProvider, and revised the CharsetProvider constructor to throw a SecurityException if the security manager refuses permission.
  • Replaced the insecure CharsetProvider method putCharsets with a new method named charsets. The new method creates an iterator for the charsets supported by the provider.
  • Added a security check to the SelectorProvider constructor.

  • Removed the setProvider method of SelectorProvider. Trusted code can still declare its own selector provider as the system-wide default by setting a system property on the command line or making a provider available as a service. (The specification of the provider method describes the lookup algorithm in detail.)

  • Declared public static fields in CodingErrorAction to be final.

Copyright © 2002 Sun Microsystems, Inc. All Rights Reserved.

Please send comments to: java-io@java.sun.com
Sun
Java Software