Wednesday, August 22, 2012

JDK7: Changes done in existing IO/NIO classes to adapt NIO.2 APIs

Changes to existing classes
  1. java.io.File
    Is updated with a toPath() method that returns a java.nio.file.Path object constructed from the abstract path.

  2. java.io.FilePermission
    Is updated to support an action that grants the ability to read a symbolic link.

  3. java.util.Scanner
    Is updated with new constructors that create a text scanner for scanning files located by a java.nio.file.Path.

  4. java.nio.channels.SocketChannel
    Is updated to implement java.nio.channels.NetworkChannel and additionally defines the methods: shutdownInput(), shutdownOutput(), and getRemoteAddress().

  5. java.nio.channels.ServerSocket
    Is updated to implement java.nio.channels.NetworkChannel and additionally defines the method bind(SocketAddress,int).

  6. java.nio.channels.DatagramChannel
    Is updated to implement java.nio.channels.MulticastChannel and additionally defines the methods open(ProtocolFamily) and getRemoteAddress().

  7. java.nio.channels.FileChannel
    Is updated to implement java.nio.channels.SeekableByteChannel and additionally defines new static methods to open/create the file.

  8. java.nio.channels.FileLock
    Is updated to define a new protected constructor for when the lock is acquired via an AsynchronousFileChannel.
    FileLock is also updated to define the method acquiredBy().

  9. java.nio.channels.Channels
    Is updated with two methods for interoperation between AsynchronousByteChannel types and streams.