提交 ecbbccf3 编写于 作者: X xdono

Merge

...@@ -398,16 +398,7 @@ ifeq ($(ARCH), ia64) ...@@ -398,16 +398,7 @@ ifeq ($(ARCH), ia64)
# SA will never be supported here. # SA will never be supported here.
INCLUDE_SA = false INCLUDE_SA = false
else else
# Hopefully, SA will be supported here one of these days,
# and these will be changed to true. Until then,
# to build SA on windows, do a control build with
# BUILD_WIN_SA=1
# on the make command.
ifdef BUILD_WIN_SA
INCLUDE_SA = true INCLUDE_SA = true
else
INCLUDE_SA = false
endif
endif endif
# Settings for the VERSIONINFO tap on windows. # Settings for the VERSIONINFO tap on windows.
......
# #
# Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -110,6 +110,9 @@ CORE_PKGS = \ ...@@ -110,6 +110,9 @@ CORE_PKGS = \
java.nio.channels.spi \ java.nio.channels.spi \
java.nio.charset \ java.nio.charset \
java.nio.charset.spi \ java.nio.charset.spi \
java.nio.file \
java.nio.file.attribute \
java.nio.file.spi \
java.rmi \ java.rmi \
java.rmi.activation \ java.rmi.activation \
java.rmi.dgc \ java.rmi.dgc \
......
# #
# Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -65,6 +65,8 @@ OLD_JSSE_PKGS = com.sun.net.ssl ...@@ -65,6 +65,8 @@ OLD_JSSE_PKGS = com.sun.net.ssl
HTTPSERVER_PKGS = com.sun.net.httpserver \ HTTPSERVER_PKGS = com.sun.net.httpserver \
com.sun.net.httpserver.spi com.sun.net.httpserver.spi
NIO_PKGS = com.sun.nio.file
DOCLETAPI_PKGS = com.sun.javadoc DOCLETAPI_PKGS = com.sun.javadoc
TAGLETAPI_FILE = com/sun/tools/doclets/Taglet.java TAGLETAPI_FILE = com/sun/tools/doclets/Taglet.java
...@@ -92,6 +94,7 @@ NON_CORE_PKGS = $(DOMAPI_PKGS) \ ...@@ -92,6 +94,7 @@ NON_CORE_PKGS = $(DOMAPI_PKGS) \
$(MGMT_PKGS) \ $(MGMT_PKGS) \
$(JAAS_PKGS) \ $(JAAS_PKGS) \
$(JGSS_PKGS) \ $(JGSS_PKGS) \
$(NIO_PKGS) \
$(OLD_JSSE_PKGS) \ $(OLD_JSSE_PKGS) \
$(HTTPSERVER_PKGS) \ $(HTTPSERVER_PKGS) \
$(SMARTCARDIO_PKGS) \ $(SMARTCARDIO_PKGS) \
......
# #
# Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -33,7 +33,7 @@ FILES_export = \ ...@@ -33,7 +33,7 @@ FILES_export = \
sun/nio/ch/DatagramChannelImpl.java \ sun/nio/ch/DatagramChannelImpl.java \
sun/nio/ch/DatagramDispatcher.java \ sun/nio/ch/DatagramDispatcher.java \
sun/nio/ch/FileChannelImpl.java \ sun/nio/ch/FileChannelImpl.java \
sun/nio/ch/FileDispatcher.java \ sun/nio/ch/FileDispatcherImpl.java \
sun/nio/ch/FileKey.java \ sun/nio/ch/FileKey.java \
sun/nio/ch/FileLockImpl.java \ sun/nio/ch/FileLockImpl.java \
sun/nio/ch/IOStatus.java \ sun/nio/ch/IOStatus.java \
......
# #
# Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -27,7 +27,7 @@ FILES_c = \ ...@@ -27,7 +27,7 @@ FILES_c = \
DatagramChannelImpl.c \ DatagramChannelImpl.c \
DatagramDispatcher.c \ DatagramDispatcher.c \
FileChannelImpl.c \ FileChannelImpl.c \
FileDispatcher.c \ FileDispatcherImpl.c \
FileKey.c \ FileKey.c \
IOUtil.c \ IOUtil.c \
MappedByteBuffer.c \ MappedByteBuffer.c \
......
# #
# Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -31,19 +31,29 @@ FILES_src = \ ...@@ -31,19 +31,29 @@ FILES_src = \
java/nio/MappedByteBuffer.java \ java/nio/MappedByteBuffer.java \
java/nio/StringCharBuffer.java \ java/nio/StringCharBuffer.java \
\ \
java/nio/channels/AsynchronousByteChannel.java \
java/nio/channels/AsynchronousChannel.java \
java/nio/channels/AsynchronousChannelGroup.java \
java/nio/channels/AsynchronousDatagramChannel.java \
java/nio/channels/AsynchronousFileChannel.java \
java/nio/channels/AsynchronousServerSocketChannel.java \
java/nio/channels/AsynchronousSocketChannel.java \
java/nio/channels/ByteChannel.java \ java/nio/channels/ByteChannel.java \
java/nio/channels/Channel.java \ java/nio/channels/Channel.java \
java/nio/channels/Channels.java \ java/nio/channels/Channels.java \
java/nio/channels/CompletionHandler.java \
java/nio/channels/DatagramChannel.java \ java/nio/channels/DatagramChannel.java \
java/nio/channels/FileChannel.java \ java/nio/channels/FileChannel.java \
java/nio/channels/FileLock.java \ java/nio/channels/FileLock.java \
java/nio/channels/GatheringByteChannel.java \ java/nio/channels/GatheringByteChannel.java \
java/nio/channels/InterruptibleChannel.java \ java/nio/channels/InterruptibleChannel.java \
java/nio/channels/Pipe.java \
java/nio/channels/MembershipKey.java \ java/nio/channels/MembershipKey.java \
java/nio/channels/MulticastChannel.java \ java/nio/channels/MulticastChannel.java \
java/nio/channels/NetworkChannel.java \ java/nio/channels/NetworkChannel.java \
java/nio/channels/ReadableByteChannel.java \ java/nio/channels/ReadableByteChannel.java \
java/nio/channels/ScatteringByteChannel.java \ java/nio/channels/ScatteringByteChannel.java \
java/nio/channels/SeekableByteChannel.java \
java/nio/channels/SelectableChannel.java \ java/nio/channels/SelectableChannel.java \
java/nio/channels/Selector.java \ java/nio/channels/Selector.java \
java/nio/channels/SelectionKey.java \ java/nio/channels/SelectionKey.java \
...@@ -55,6 +65,7 @@ FILES_src = \ ...@@ -55,6 +65,7 @@ FILES_src = \
java/nio/channels/spi/AbstractSelectableChannel.java \ java/nio/channels/spi/AbstractSelectableChannel.java \
java/nio/channels/spi/AbstractSelectionKey.java \ java/nio/channels/spi/AbstractSelectionKey.java \
java/nio/channels/spi/AbstractSelector.java \ java/nio/channels/spi/AbstractSelector.java \
java/nio/channels/spi/AsynchronousChannelProvider.java \
java/nio/channels/spi/SelectorProvider.java \ java/nio/channels/spi/SelectorProvider.java \
\ \
java/nio/charset/Charset.java \ java/nio/charset/Charset.java \
...@@ -66,21 +77,117 @@ FILES_src = \ ...@@ -66,21 +77,117 @@ FILES_src = \
\ \
java/nio/charset/spi/CharsetProvider.java \ java/nio/charset/spi/CharsetProvider.java \
\ \
java/nio/file/AccessDeniedException.java \
java/nio/file/AccessMode.java \
java/nio/file/AtomicMoveNotSupportedException.java \
java/nio/file/ClosedDirectoryStreamException.java \
java/nio/file/ClosedFileSystemException.java \
java/nio/file/ClosedWatchServiceException.java \
java/nio/file/CopyOption.java \
java/nio/file/DirectoryNotEmptyException.java \
java/nio/file/DirectoryStream.java \
java/nio/file/DirectoryStreamFilters.java \
java/nio/file/FileAction.java \
java/nio/file/FileAlreadyExistsException.java \
java/nio/file/FileRef.java \
java/nio/file/FileStore.java \
java/nio/file/FileSystem.java \
java/nio/file/FileSystemAlreadyExistsException.java \
java/nio/file/FileSystemException.java \
java/nio/file/FileSystemNotFoundException.java \
java/nio/file/FileSystems.java \
java/nio/file/FileTreeWalker.java \
java/nio/file/FileVisitOption.java \
java/nio/file/FileVisitResult.java \
java/nio/file/FileVisitor.java \
java/nio/file/Files.java \
java/nio/file/InvalidPathException.java \
java/nio/file/LinkOption.java \
java/nio/file/LinkPermission.java \
java/nio/file/NoSuchFileException.java \
java/nio/file/NotDirectoryException.java \
java/nio/file/NotLinkException.java \
java/nio/file/OpenOption.java \
java/nio/file/Path.java \
java/nio/file/PathMatcher.java \
java/nio/file/Paths.java \
java/nio/file/ProviderMismatchException.java \
java/nio/file/ProviderNotFoundException.java \
java/nio/file/ReadOnlyFileSystemException.java \
java/nio/file/SecureDirectoryStream.java \
java/nio/file/SimpleFileVisitor.java \
java/nio/file/StandardCopyOption.java \
java/nio/file/StandardOpenOption.java \
java/nio/file/StandardWatchEventKind.java \
java/nio/file/WatchEvent.java \
java/nio/file/WatchKey.java \
java/nio/file/WatchService.java \
java/nio/file/Watchable.java \
\
java/nio/file/attribute/AclEntry.java \
java/nio/file/attribute/AclEntryFlag.java \
java/nio/file/attribute/AclEntryPermission.java \
java/nio/file/attribute/AclEntryType.java \
java/nio/file/attribute/AclFileAttributeView.java \
java/nio/file/attribute/AttributeView.java \
java/nio/file/attribute/Attributes.java \
java/nio/file/attribute/BasicFileAttributeView.java \
java/nio/file/attribute/BasicFileAttributes.java \
java/nio/file/attribute/DosFileAttributeView.java \
java/nio/file/attribute/DosFileAttributes.java \
java/nio/file/attribute/FileAttribute.java \
java/nio/file/attribute/FileAttributeView.java \
java/nio/file/attribute/FileOwnerAttributeView.java \
java/nio/file/attribute/FileStoreAttributeView.java \
java/nio/file/attribute/FileStoreSpaceAttributeView.java \
java/nio/file/attribute/FileStoreSpaceAttributes.java \
java/nio/file/attribute/GroupPrincipal.java \
java/nio/file/attribute/UserDefinedFileAttributeView.java \
java/nio/file/attribute/PosixFileAttributeView.java \
java/nio/file/attribute/PosixFileAttributes.java \
java/nio/file/attribute/PosixFilePermission.java \
java/nio/file/attribute/PosixFilePermissions.java \
java/nio/file/attribute/UserPrincipal.java \
java/nio/file/attribute/UserPrincipalLookupService.java \
java/nio/file/attribute/UserPrincipalNotFoundException.java \
\
java/nio/file/spi/AbstractPath.java \
java/nio/file/spi/FileSystemProvider.java \
java/nio/file/spi/FileTypeDetector.java \
\
com/sun/nio/file/ExtendedCopyOption.java \
com/sun/nio/file/ExtendedOpenOption.java \
com/sun/nio/file/ExtendedWatchEventModifier.java \
com/sun/nio/file/SensitivityWatchEventModifier.java \
\
sun/nio/ByteBuffered.java \ sun/nio/ByteBuffered.java \
\ \
sun/nio/ch/AbstractFuture.java \
sun/nio/ch/AbstractPollArrayWrapper.java \ sun/nio/ch/AbstractPollArrayWrapper.java \
sun/nio/ch/AllocatedNativeObject.java \ sun/nio/ch/AllocatedNativeObject.java \
sun/nio/ch/AsynchronousChannelGroupImpl.java \
sun/nio/ch/AsynchronousFileChannelImpl.java \
sun/nio/ch/AsynchronousServerSocketChannelImpl.java \
sun/nio/ch/AsynchronousSocketChannelImpl.java \
sun/nio/ch/Cancellable.java \
sun/nio/ch/ChannelInputStream.java \ sun/nio/ch/ChannelInputStream.java \
sun/nio/ch/CompletedFuture.java \
sun/nio/ch/DatagramChannelImpl.java \ sun/nio/ch/DatagramChannelImpl.java \
sun/nio/ch/DatagramDispatcher.java \ sun/nio/ch/DatagramDispatcher.java \
sun/nio/ch/DatagramSocketAdaptor.java \ sun/nio/ch/DatagramSocketAdaptor.java \
sun/nio/ch/DefaultAsynchronousChannelProvider.java \
sun/nio/ch/DefaultSelectorProvider.java \ sun/nio/ch/DefaultSelectorProvider.java \
sun/nio/ch/DirectBuffer.java \ sun/nio/ch/DirectBuffer.java \
sun/nio/ch/ExtendedSocketOption.java \ sun/nio/ch/ExtendedSocketOption.java \
sun/nio/ch/FileChannelImpl.java \ sun/nio/ch/FileChannelImpl.java \
sun/nio/ch/FileDispatcher.java \ sun/nio/ch/FileDispatcher.java \
sun/nio/ch/FileDispatcherImpl.java \
sun/nio/ch/FileKey.java \ sun/nio/ch/FileKey.java \
sun/nio/ch/FileLockImpl.java \
sun/nio/ch/FileLockTable.java \
sun/nio/ch/Groupable.java \
sun/nio/ch/Interruptible.java \ sun/nio/ch/Interruptible.java \
sun/nio/ch/Invoker.java \
sun/nio/ch/IOUtil.java \ sun/nio/ch/IOUtil.java \
sun/nio/ch/IOStatus.java \ sun/nio/ch/IOStatus.java \
sun/nio/ch/IOVecWrapper.java \ sun/nio/ch/IOVecWrapper.java \
...@@ -92,6 +199,7 @@ FILES_src = \ ...@@ -92,6 +199,7 @@ FILES_src = \
sun/nio/ch/NativeThreadSet.java \ sun/nio/ch/NativeThreadSet.java \
sun/nio/ch/Net.java \ sun/nio/ch/Net.java \
sun/nio/ch/OptionKey.java \ sun/nio/ch/OptionKey.java \
sun/nio/ch/PendingFuture.java \
sun/nio/ch/PipeImpl.java \ sun/nio/ch/PipeImpl.java \
sun/nio/ch/PollArrayWrapper.java \ sun/nio/ch/PollArrayWrapper.java \
sun/nio/ch/Reflect.java \ sun/nio/ch/Reflect.java \
...@@ -101,12 +209,14 @@ FILES_src = \ ...@@ -101,12 +209,14 @@ FILES_src = \
sun/nio/ch/SelChImpl.java \ sun/nio/ch/SelChImpl.java \
sun/nio/ch/ServerSocketAdaptor.java \ sun/nio/ch/ServerSocketAdaptor.java \
sun/nio/ch/ServerSocketChannelImpl.java \ sun/nio/ch/ServerSocketChannelImpl.java \
sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java \
sun/nio/ch/SinkChannelImpl.java \ sun/nio/ch/SinkChannelImpl.java \
sun/nio/ch/SocketAdaptor.java \ sun/nio/ch/SocketAdaptor.java \
sun/nio/ch/SocketChannelImpl.java \ sun/nio/ch/SocketChannelImpl.java \
sun/nio/ch/SocketDispatcher.java \ sun/nio/ch/SocketDispatcher.java \
sun/nio/ch/SocketOptionRegistry.java \ sun/nio/ch/SocketOptionRegistry.java \
sun/nio/ch/SourceChannelImpl.java \ sun/nio/ch/SourceChannelImpl.java \
sun/nio/ch/ThreadPool.java \
sun/nio/ch/Util.java \ sun/nio/ch/Util.java \
\ \
sun/nio/cs/AbstractCharsetProvider.java \ sun/nio/cs/AbstractCharsetProvider.java \
...@@ -134,6 +244,25 @@ FILES_src = \ ...@@ -134,6 +244,25 @@ FILES_src = \
sun/nio/cs/UTF_32LE_BOM.java \ sun/nio/cs/UTF_32LE_BOM.java \
sun/nio/cs/UTF_32Coder.java \ sun/nio/cs/UTF_32Coder.java \
\ \
sun/nio/fs/AbstractAclFileAttributeView.java \
sun/nio/fs/AbstractBasicFileAttributeView.java \
sun/nio/fs/AbstractFileStoreSpaceAttributeView.java \
sun/nio/fs/AbstractFileTypeDetector.java \
sun/nio/fs/AbstractPoller.java \
sun/nio/fs/AbstractUserDefinedFileAttributeView.java \
sun/nio/fs/AbstractWatchKey.java \
sun/nio/fs/AbstractWatchService.java \
sun/nio/fs/BasicFileAttributesHolder.java \
sun/nio/fs/Cancellable.java \
sun/nio/fs/DefaultFileSystemProvider.java \
sun/nio/fs/DefaultFileTypeDetector.java \
sun/nio/fs/FileOwnerAttributeViewImpl.java \
sun/nio/fs/Globs.java \
sun/nio/fs/MimeType.java \
sun/nio/fs/NativeBuffer.java \
sun/nio/fs/NativeBuffers.java \
sun/nio/fs/Reflect.java \
\
java/net/DatagramSocket.java \ java/net/DatagramSocket.java \
java/net/DatagramSocketImpl.java \ java/net/DatagramSocketImpl.java \
java/net/PlainSocketImpl.java \ java/net/PlainSocketImpl.java \
...@@ -244,24 +373,31 @@ FILES_gen_ex = \ ...@@ -244,24 +373,31 @@ FILES_gen_ex = \
java/nio/InvalidMarkException.java \ java/nio/InvalidMarkException.java \
java/nio/ReadOnlyBufferException.java \ java/nio/ReadOnlyBufferException.java \
\ \
java/nio/channels/AcceptPendingException.java \
java/nio/channels/AlreadyBoundException.java \ java/nio/channels/AlreadyBoundException.java \
java/nio/channels/AlreadyConnectedException.java \ java/nio/channels/AlreadyConnectedException.java \
java/nio/channels/AsynchronousCloseException.java \ java/nio/channels/AsynchronousCloseException.java \
java/nio/channels/CancelledKeyException.java \
java/nio/channels/ClosedByInterruptException.java \ java/nio/channels/ClosedByInterruptException.java \
java/nio/channels/ClosedChannelException.java \ java/nio/channels/ClosedChannelException.java \
java/nio/channels/ClosedSelectorException.java \ java/nio/channels/ClosedSelectorException.java \
java/nio/channels/ConnectionPendingException.java \ java/nio/channels/ConnectionPendingException.java \
java/nio/channels/FileLockInterruptionException.java \ java/nio/channels/FileLockInterruptionException.java \
java/nio/channels/IllegalBlockingModeException.java \ java/nio/channels/IllegalBlockingModeException.java \
java/nio/channels/IllegalChannelGroupException.java \
java/nio/channels/IllegalSelectorException.java \ java/nio/channels/IllegalSelectorException.java \
java/nio/channels/InterruptedByTimeoutException.java \
java/nio/channels/NoConnectionPendingException.java \ java/nio/channels/NoConnectionPendingException.java \
java/nio/channels/NonReadableChannelException.java \ java/nio/channels/NonReadableChannelException.java \
java/nio/channels/NonWritableChannelException.java \ java/nio/channels/NonWritableChannelException.java \
java/nio/channels/NotYetBoundException.java \ java/nio/channels/NotYetBoundException.java \
java/nio/channels/NotYetConnectedException.java \ java/nio/channels/NotYetConnectedException.java \
java/nio/channels/OverlappingFileLockException.java \ java/nio/channels/OverlappingFileLockException.java \
java/nio/channels/ReadPendingException.java \
java/nio/channels/ShutdownChannelGroupException.java \
java/nio/channels/UnresolvedAddressException.java \ java/nio/channels/UnresolvedAddressException.java \
java/nio/channels/UnsupportedAddressTypeException.java \ java/nio/channels/UnsupportedAddressTypeException.java \
java/nio/channels/WritePendingException.java \
\ \
java/nio/charset/CharacterCodingException.java \ java/nio/charset/CharacterCodingException.java \
java/nio/charset/IllegalCharsetNameException.java \ java/nio/charset/IllegalCharsetNameException.java \
......
# #
# Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -56,56 +56,214 @@ FILES_java += \ ...@@ -56,56 +56,214 @@ FILES_java += \
sun/nio/ch/DevPollSelectorProvider.java \ sun/nio/ch/DevPollSelectorProvider.java \
sun/nio/ch/InheritedChannel.java \ sun/nio/ch/InheritedChannel.java \
sun/nio/ch/PollSelectorProvider.java \ sun/nio/ch/PollSelectorProvider.java \
sun/nio/ch/PollSelectorImpl.java sun/nio/ch/PollSelectorImpl.java \
sun/nio/ch/Port.java \
sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \
sun/nio/ch/SolarisAsynchronousChannelProvider.java \
sun/nio/ch/SolarisEventPort.java \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/PollingWatchService.java \
sun/nio/fs/SolarisAclFileAttributeView.java \
sun/nio/fs/SolarisFileStore.java \
sun/nio/fs/SolarisFileSystem.java \
sun/nio/fs/SolarisFileSystemProvider.java \
sun/nio/fs/SolarisUserDefinedFileAttributeView.java \
sun/nio/fs/SolarisNativeDispatcher.java \
sun/nio/fs/SolarisWatchService.java \
sun/nio/fs/UnixChannelFactory.java \
sun/nio/fs/UnixCopyFile.java \
sun/nio/fs/UnixDirectoryStream.java \
sun/nio/fs/UnixException.java \
sun/nio/fs/UnixFileAttributeViews.java \
sun/nio/fs/UnixFileAttributes.java \
sun/nio/fs/UnixFileKey.java \
sun/nio/fs/UnixFileModeAttribute.java \
sun/nio/fs/UnixFileStore.java \
sun/nio/fs/UnixFileStoreAttributes.java \
sun/nio/fs/UnixFileSystem.java \
sun/nio/fs/UnixFileSystemProvider.java \
sun/nio/fs/UnixMountEntry.java \
sun/nio/fs/UnixNativeDispatcher.java \
sun/nio/fs/UnixPath.java \
sun/nio/fs/UnixSecureDirectoryStream.java \
sun/nio/fs/UnixUriUtils.java \
sun/nio/fs/UnixUserPrincipals.java
FILES_c += \ FILES_c += \
DevPollArrayWrapper.c \ DevPollArrayWrapper.c \
InheritedChannel.c \ InheritedChannel.c \
NativeThread.c \ NativeThread.c \
PollArrayWrapper.c PollArrayWrapper.c \
SolarisEventPort.c \
UnixAsynchronousServerSocketChannelImpl.c \
UnixAsynchronousSocketChannelImpl.c \
\
GnomeFileTypeDetector.c \
SolarisNativeDispatcher.c \
SolarisWatchService.c \
UnixCopyFile.c \
UnixNativeDispatcher.c
FILES_export += \ FILES_export += \
sun/nio/ch/DevPollArrayWrapper.java \ sun/nio/ch/DevPollArrayWrapper.java \
sun/nio/ch/InheritedChannel.java \ sun/nio/ch/InheritedChannel.java \
sun/nio/ch/NativeThread.java sun/nio/ch/NativeThread.java \
sun/nio/ch/SolarisEventPort.java \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/SolarisNativeDispatcher.java \
sun/nio/fs/SolarisWatchService.java \
sun/nio/fs/UnixCopyFile.java \
sun/nio/fs/UnixNativeDispatcher.java
FILES_gen += \
sun/nio/fs/SolarisConstants.java \
sun/nio/fs/UnixConstants.java
endif # PLATFORM = solaris endif # PLATFORM = solaris
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
FILES_java += \ FILES_java += \
sun/nio/ch/Iocp.java \
sun/nio/ch/PendingIoCache.java \
sun/nio/ch/WindowsAsynchronousChannelProvider.java \
sun/nio/ch/WindowsAsynchronousFileChannelImpl.java \
sun/nio/ch/WindowsAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java \
sun/nio/ch/WindowsSelectorImpl.java \ sun/nio/ch/WindowsSelectorImpl.java \
sun/nio/ch/WindowsSelectorProvider.java sun/nio/ch/WindowsSelectorProvider.java \
\
sun/nio/fs/RegistryFileTypeDetector.java \
sun/nio/fs/WindowsAclFileAttributeView.java \
sun/nio/fs/WindowsChannelFactory.java \
sun/nio/fs/WindowsConstants.java \
sun/nio/fs/WindowsDirectoryStream.java \
sun/nio/fs/WindowsException.java \
sun/nio/fs/WindowsFileAttributeViews.java \
sun/nio/fs/WindowsFileAttributes.java \
sun/nio/fs/WindowsFileCopy.java \
sun/nio/fs/WindowsFileStore.java \
sun/nio/fs/WindowsFileSystem.java \
sun/nio/fs/WindowsFileSystemProvider.java \
sun/nio/fs/WindowsLinkSupport.java \
sun/nio/fs/WindowsUserDefinedFileAttributeView.java \
sun/nio/fs/WindowsNativeDispatcher.java \
sun/nio/fs/WindowsPath.java \
sun/nio/fs/WindowsPathParser.java \
sun/nio/fs/WindowsPathType.java \
sun/nio/fs/WindowsSecurity.java \
sun/nio/fs/WindowsSecurityDescriptor.java \
sun/nio/fs/WindowsUriSupport.java \
sun/nio/fs/WindowsUserPrincipals.java \
sun/nio/fs/WindowsWatchService.java
FILES_c += \ FILES_c += \
Iocp.c \
RegistryFileTypeDetector.c \
WindowsAsynchronousFileChannelImpl.c \
WindowsAsynchronousServerSocketChannelImpl.c \
WindowsAsynchronousSocketChannelImpl.c \
WindowsNativeDispatcher.c \
WindowsSelectorImpl.c WindowsSelectorImpl.c
FILES_export += \ FILES_export += \
sun/nio/ch/WindowsSelectorImpl.java sun/nio/ch/Iocp.java \
sun/nio/ch/WindowsAsynchronousFileChannelImpl.java \
sun/nio/ch/WindowsAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java \
sun/nio/ch/WindowsSelectorImpl.java \
sun/nio/fs/WindowsNativeDispatcher.java \
sun/nio/fs/RegistryFileTypeDetector.java
endif # PLATFORM = windows endif # PLATFORM = windows
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
FILES_java += \ FILES_java += \
sun/nio/ch/AbstractPollSelectorImpl.java \ sun/nio/ch/AbstractPollSelectorImpl.java \
sun/nio/ch/EPoll.java \
sun/nio/ch/EPollArrayWrapper.java \ sun/nio/ch/EPollArrayWrapper.java \
sun/nio/ch/EPollPort.java \
sun/nio/ch/EPollSelectorProvider.java \ sun/nio/ch/EPollSelectorProvider.java \
sun/nio/ch/EPollSelectorImpl.java \ sun/nio/ch/EPollSelectorImpl.java \
sun/nio/ch/InheritedChannel.java \ sun/nio/ch/InheritedChannel.java \
sun/nio/ch/LinuxAsynchronousChannelProvider.java \
sun/nio/ch/PollSelectorProvider.java \ sun/nio/ch/PollSelectorProvider.java \
sun/nio/ch/PollSelectorImpl.java sun/nio/ch/PollSelectorImpl.java \
sun/nio/ch/Port.java \
sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/LinuxDosFileAttributeView.java \
sun/nio/fs/LinuxFileStore.java \
sun/nio/fs/LinuxFileSystem.java \
sun/nio/fs/LinuxFileSystemProvider.java \
sun/nio/fs/LinuxUserDefinedFileAttributeView.java \
sun/nio/fs/LinuxNativeDispatcher.java \
sun/nio/fs/LinuxWatchService.java \
sun/nio/fs/PollingWatchService.java \
sun/nio/fs/UnixChannelFactory.java \
sun/nio/fs/UnixCopyFile.java \
sun/nio/fs/UnixDirectoryStream.java \
sun/nio/fs/UnixException.java \
sun/nio/fs/UnixFileAttributeViews.java \
sun/nio/fs/UnixFileAttributes.java \
sun/nio/fs/UnixFileKey.java \
sun/nio/fs/UnixFileModeAttribute.java \
sun/nio/fs/UnixFileStore.java \
sun/nio/fs/UnixFileStoreAttributes.java \
sun/nio/fs/UnixFileSystem.java \
sun/nio/fs/UnixFileSystemProvider.java \
sun/nio/fs/UnixMountEntry.java \
sun/nio/fs/UnixNativeDispatcher.java \
sun/nio/fs/UnixPath.java \
sun/nio/fs/UnixSecureDirectoryStream.java \
sun/nio/fs/UnixUriUtils.java \
sun/nio/fs/UnixUserPrincipals.java
FILES_c += \ FILES_c += \
EPoll.c \
EPollArrayWrapper.c \ EPollArrayWrapper.c \
EPollPort.c \
InheritedChannel.c \ InheritedChannel.c \
NativeThread.c \ NativeThread.c \
PollArrayWrapper.c PollArrayWrapper.c \
UnixAsynchronousServerSocketChannelImpl.c \
UnixAsynchronousSocketChannelImpl.c \
\
GnomeFileTypeDetector.c \
LinuxNativeDispatcher.c \
LinuxWatchService.c \
UnixCopyFile.c \
UnixNativeDispatcher.c
FILES_export += \ FILES_export += \
sun/nio/ch/EPoll.java \
sun/nio/ch/EPollArrayWrapper.java \ sun/nio/ch/EPollArrayWrapper.java \
sun/nio/ch/EPollPort.java \
sun/nio/ch/InheritedChannel.java \ sun/nio/ch/InheritedChannel.java \
sun/nio/ch/NativeThread.java sun/nio/ch/NativeThread.java \
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/LinuxNativeDispatcher.java \
sun/nio/fs/LinuxWatchService.java \
sun/nio/fs/UnixCopyFile.java \
sun/nio/fs/UnixNativeDispatcher.java
FILES_gen += \
sun/nio/fs/UnixConstants.java
endif # PLATFORM = linux endif # PLATFORM = linux
#
# Find platform-specific C source files # Find platform-specific C source files
# #
vpath %.c $(PLATFORM_SRC)/native/sun/nio/fs
vpath %.c $(PLATFORM_SRC)/native/sun/nio/ch vpath %.c $(PLATFORM_SRC)/native/sun/nio/ch
vpath %.c $(SHARE_SRC)/native/sun/nio/ch vpath %.c $(SHARE_SRC)/native/sun/nio/ch
...@@ -175,12 +333,14 @@ CH_SRC=$(NIO_SRC)/channels ...@@ -175,12 +333,14 @@ CH_SRC=$(NIO_SRC)/channels
CS_SRC=$(NIO_SRC)/charset CS_SRC=$(NIO_SRC)/charset
SCH_SRC=$(SNIO_SRC)/ch SCH_SRC=$(SNIO_SRC)/ch
SCS_SRC=$(SNIO_SRC)/cs SCS_SRC=$(SNIO_SRC)/cs
SFS_SRC=$(SNIO_SRC)/fs
BUF_GEN=$(NIO_GEN) BUF_GEN=$(NIO_GEN)
CH_GEN=$(NIO_GEN)/channels CH_GEN=$(NIO_GEN)/channels
CS_GEN=$(NIO_GEN)/charset CS_GEN=$(NIO_GEN)/charset
SCH_GEN=$(SNIO_GEN)/ch SCH_GEN=$(SNIO_GEN)/ch
SCS_GEN=$(SNIO_GEN)/cs SCS_GEN=$(SNIO_GEN)/cs
SFS_GEN=$(SNIO_GEN)/fs
FILES_gensbcs_out = $(FILES_gen_sbcs:%.java=$(GENSRCDIR)/%.java) FILES_gensbcs_out = $(FILES_gen_sbcs:%.java=$(GENSRCDIR)/%.java)
...@@ -670,4 +830,40 @@ $(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java $(GENCSSRC)/sbcs ...@@ -670,4 +830,40 @@ $(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java $(GENCSSRC)/sbcs
$(BOOT_JAVA_CMD) -cp $(CHARSETMAPPING_JARFILE) build.tools.charsetmapping.GenerateSBCS \ $(BOOT_JAVA_CMD) -cp $(CHARSETMAPPING_JARFILE) build.tools.charsetmapping.GenerateSBCS \
$(GENCSSRC) $(SCS_GEN) sbcs $(GENCSSRC) $(SCS_GEN) sbcs
#
# Generated file system implementation classes (Unix only)
#
GENUC_SRC = $(PLATFORM_SRC)/native/sun/nio/fs/genUnixConstants.c
GENUC_EXE = $(TEMPDIR)/genUnixConstants
GENUC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENUC_SRC) | \
$(NAWK) '/^.*Copyright.*Sun/ { print $$3 }')
$(GENUC_EXE) : $(GENUC_SRC)
$(prep-target)
$(CC) $(CPPFLAGS) -o $@ $(GENUC_SRC)
$(SFS_GEN)/UnixConstants.java: $(GENUC_EXE)
$(prep-target)
NAWK="$(NAWK)" SH="$(SH)" $(SH) -e addNotices.sh $(GENUC_COPYRIGHT_YEARS) > $@
$(GENUC_EXE) >> $@
GENSC_SRC = $(PLATFORM_SRC)/native/sun/nio/fs/genSolarisConstants.c
GENSC_EXE = $(TEMPDIR)/genSolarisConstants
GENSC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSC_SRC) | \
$(NAWK) '/^.*Copyright.*Sun/ { print $$3 }')
$(GENSC_EXE) : $(GENSC_SRC)
$(prep-target)
$(CC) $(CPPFLAGS) -o $@ $(GENSC_SRC)
$(SFS_GEN)/SolarisConstants.java: $(GENSC_EXE)
$(prep-target)
NAWK="$(NAWK)" SH="$(SH)" $(SH) -e addNotices.sh $(GENSC_COPYRIGHT_YEARS) > $@
$(GENSC_EXE) >> $@
.PHONY: sources .PHONY: sources
# #
# Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -44,27 +44,38 @@ SUNWprivate_1.1 { ...@@ -44,27 +44,38 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_EPollArrayWrapper_interrupt; Java_sun_nio_ch_EPollArrayWrapper_interrupt;
Java_sun_nio_ch_EPollArrayWrapper_offsetofData; Java_sun_nio_ch_EPollArrayWrapper_offsetofData;
Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent; Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent;
Java_sun_nio_ch_EPoll_init;
Java_sun_nio_ch_EPoll_eventSize;
Java_sun_nio_ch_EPoll_eventsOffset;
Java_sun_nio_ch_EPoll_dataOffset;
Java_sun_nio_ch_EPoll_epollCreate;
Java_sun_nio_ch_EPoll_epollCtl;
Java_sun_nio_ch_EPoll_epollWait;
Java_sun_nio_ch_EPollPort_close0;
Java_sun_nio_ch_EPollPort_drain1;
Java_sun_nio_ch_EPollPort_interrupt;
Java_sun_nio_ch_EPollPort_socketpair;
Java_sun_nio_ch_FileChannelImpl_close0; Java_sun_nio_ch_FileChannelImpl_close0;
Java_sun_nio_ch_FileChannelImpl_force0;
Java_sun_nio_ch_FileChannelImpl_initIDs; Java_sun_nio_ch_FileChannelImpl_initIDs;
Java_sun_nio_ch_FileChannelImpl_lock0;
Java_sun_nio_ch_FileChannelImpl_map0; Java_sun_nio_ch_FileChannelImpl_map0;
Java_sun_nio_ch_FileChannelImpl_position0; Java_sun_nio_ch_FileChannelImpl_position0;
Java_sun_nio_ch_FileChannelImpl_release0;
Java_sun_nio_ch_FileChannelImpl_size0;
Java_sun_nio_ch_FileChannelImpl_transferTo0; Java_sun_nio_ch_FileChannelImpl_transferTo0;
Java_sun_nio_ch_FileChannelImpl_truncate0;
Java_sun_nio_ch_FileChannelImpl_unmap0; Java_sun_nio_ch_FileChannelImpl_unmap0;
Java_sun_nio_ch_FileDispatcher_close0; Java_sun_nio_ch_FileDispatcherImpl_close0;
Java_sun_nio_ch_FileDispatcher_closeIntFD; Java_sun_nio_ch_FileDispatcherImpl_closeIntFD;
Java_sun_nio_ch_FileDispatcher_init; Java_sun_nio_ch_FileDispatcherImpl_force0;
Java_sun_nio_ch_FileDispatcher_preClose0; Java_sun_nio_ch_FileDispatcherImpl_init;
Java_sun_nio_ch_FileDispatcher_pread0; Java_sun_nio_ch_FileDispatcherImpl_lock0;
Java_sun_nio_ch_FileDispatcher_pwrite0; Java_sun_nio_ch_FileDispatcherImpl_preClose0;
Java_sun_nio_ch_FileDispatcher_read0; Java_sun_nio_ch_FileDispatcherImpl_pread0;
Java_sun_nio_ch_FileDispatcher_readv0; Java_sun_nio_ch_FileDispatcherImpl_pwrite0;
Java_sun_nio_ch_FileDispatcher_write0; Java_sun_nio_ch_FileDispatcherImpl_read0;
Java_sun_nio_ch_FileDispatcher_writev0; Java_sun_nio_ch_FileDispatcherImpl_readv0;
Java_sun_nio_ch_FileDispatcherImpl_release0;
Java_sun_nio_ch_FileDispatcherImpl_size0;
Java_sun_nio_ch_FileDispatcherImpl_truncate0;
Java_sun_nio_ch_FileDispatcherImpl_write0;
Java_sun_nio_ch_FileDispatcherImpl_writev0;
Java_sun_nio_ch_FileKey_init; Java_sun_nio_ch_FileKey_init;
Java_sun_nio_ch_FileKey_initIDs; Java_sun_nio_ch_FileKey_initIDs;
Java_sun_nio_ch_InheritedChannel_close0; Java_sun_nio_ch_InheritedChannel_close0;
...@@ -108,6 +119,76 @@ SUNWprivate_1.1 { ...@@ -108,6 +119,76 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_ServerSocketChannelImpl_accept0; Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
Java_sun_nio_ch_ServerSocketChannelImpl_initIDs; Java_sun_nio_ch_ServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_SocketChannelImpl_checkConnect; Java_sun_nio_ch_SocketChannelImpl_checkConnect;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
Java_sun_nio_fs_LinuxWatchService_init;
Java_sun_nio_fs_LinuxWatchService_eventSize;
Java_sun_nio_fs_LinuxWatchService_eventOffsets;
Java_sun_nio_fs_LinuxWatchService_inotifyInit;
Java_sun_nio_fs_LinuxWatchService_inotifyAddWatch;
Java_sun_nio_fs_LinuxWatchService_inotifyRmWatch;
Java_sun_nio_fs_LinuxWatchService_configureBlocking;
Java_sun_nio_fs_LinuxWatchService_socketpair;
Java_sun_nio_fs_LinuxWatchService_poll;
Java_sun_nio_fs_LinuxNativeDispatcher_init;
Java_sun_nio_fs_LinuxNativeDispatcher_fgetxattr0;
Java_sun_nio_fs_LinuxNativeDispatcher_flistxattr;
Java_sun_nio_fs_LinuxNativeDispatcher_fsetxattr0;
Java_sun_nio_fs_LinuxNativeDispatcher_fremovexattr0;
Java_sun_nio_fs_LinuxNativeDispatcher_setmntent0;
Java_sun_nio_fs_LinuxNativeDispatcher_endmntent;
Java_sun_nio_fs_UnixNativeDispatcher_initIDs;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
Java_sun_nio_fs_UnixNativeDispatcher_dup;
Java_sun_nio_fs_UnixNativeDispatcher_access0;
Java_sun_nio_fs_UnixNativeDispatcher_stat0;
Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
Java_sun_nio_fs_UnixNativeDispatcher_fstat;
Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
Java_sun_nio_fs_UnixNativeDispatcher_chmod0;
Java_sun_nio_fs_UnixNativeDispatcher_fchmod;
Java_sun_nio_fs_UnixNativeDispatcher_chown0;
Java_sun_nio_fs_UnixNativeDispatcher_lchown0;
Java_sun_nio_fs_UnixNativeDispatcher_fchown;
Java_sun_nio_fs_UnixNativeDispatcher_utimes0;
Java_sun_nio_fs_UnixNativeDispatcher_futimes;
Java_sun_nio_fs_UnixNativeDispatcher_open0;
Java_sun_nio_fs_UnixNativeDispatcher_openat0;
Java_sun_nio_fs_UnixNativeDispatcher_close;
Java_sun_nio_fs_UnixNativeDispatcher_read;
Java_sun_nio_fs_UnixNativeDispatcher_write;
Java_sun_nio_fs_UnixNativeDispatcher_fopen0;
Java_sun_nio_fs_UnixNativeDispatcher_fclose;
Java_sun_nio_fs_UnixNativeDispatcher_opendir0;
Java_sun_nio_fs_UnixNativeDispatcher_fdopendir;
Java_sun_nio_fs_UnixNativeDispatcher_readdir;
Java_sun_nio_fs_UnixNativeDispatcher_closedir;
Java_sun_nio_fs_UnixNativeDispatcher_link0;
Java_sun_nio_fs_UnixNativeDispatcher_unlink0;
Java_sun_nio_fs_UnixNativeDispatcher_unlinkat0;
Java_sun_nio_fs_UnixNativeDispatcher_rename0;
Java_sun_nio_fs_UnixNativeDispatcher_renameat0;
Java_sun_nio_fs_UnixNativeDispatcher_mkdir0;
Java_sun_nio_fs_UnixNativeDispatcher_rmdir0;
Java_sun_nio_fs_UnixNativeDispatcher_symlink0;
Java_sun_nio_fs_UnixNativeDispatcher_readlink0;
Java_sun_nio_fs_UnixNativeDispatcher_realpath0;
Java_sun_nio_fs_UnixNativeDispatcher_statvfs0;
Java_sun_nio_fs_UnixNativeDispatcher_pathconf0;
Java_sun_nio_fs_UnixNativeDispatcher_fpathconf;
Java_sun_nio_fs_UnixNativeDispatcher_mknod0;
Java_sun_nio_fs_UnixNativeDispatcher_getpwuid;
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
Java_sun_nio_fs_UnixCopyFile_transfer;
local: local:
*; *;
......
# #
# Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -43,26 +43,26 @@ SUNWprivate_1.1 { ...@@ -43,26 +43,26 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_DevPollArrayWrapper_register; Java_sun_nio_ch_DevPollArrayWrapper_register;
Java_sun_nio_ch_DevPollArrayWrapper_registerMultiple; Java_sun_nio_ch_DevPollArrayWrapper_registerMultiple;
Java_sun_nio_ch_FileChannelImpl_close0; Java_sun_nio_ch_FileChannelImpl_close0;
Java_sun_nio_ch_FileChannelImpl_force0;
Java_sun_nio_ch_FileChannelImpl_initIDs; Java_sun_nio_ch_FileChannelImpl_initIDs;
Java_sun_nio_ch_FileChannelImpl_lock0;
Java_sun_nio_ch_FileChannelImpl_map0; Java_sun_nio_ch_FileChannelImpl_map0;
Java_sun_nio_ch_FileChannelImpl_position0; Java_sun_nio_ch_FileChannelImpl_position0;
Java_sun_nio_ch_FileChannelImpl_release0;
Java_sun_nio_ch_FileChannelImpl_size0;
Java_sun_nio_ch_FileChannelImpl_transferTo0; Java_sun_nio_ch_FileChannelImpl_transferTo0;
Java_sun_nio_ch_FileChannelImpl_truncate0;
Java_sun_nio_ch_FileChannelImpl_unmap0; Java_sun_nio_ch_FileChannelImpl_unmap0;
Java_sun_nio_ch_FileDispatcher_close0; Java_sun_nio_ch_FileDispatcherImpl_close0;
Java_sun_nio_ch_FileDispatcher_closeIntFD; Java_sun_nio_ch_FileDispatcherImpl_closeIntFD;
Java_sun_nio_ch_FileDispatcher_init; Java_sun_nio_ch_FileDispatcherImpl_force0;
Java_sun_nio_ch_FileDispatcher_preClose0; Java_sun_nio_ch_FileDispatcherImpl_init;
Java_sun_nio_ch_FileDispatcher_pread0; Java_sun_nio_ch_FileDispatcherImpl_lock0;
Java_sun_nio_ch_FileDispatcher_pwrite0; Java_sun_nio_ch_FileDispatcherImpl_preClose0;
Java_sun_nio_ch_FileDispatcher_read0; Java_sun_nio_ch_FileDispatcherImpl_pread0;
Java_sun_nio_ch_FileDispatcher_readv0; Java_sun_nio_ch_FileDispatcherImpl_pwrite0;
Java_sun_nio_ch_FileDispatcher_write0; Java_sun_nio_ch_FileDispatcherImpl_read0;
Java_sun_nio_ch_FileDispatcher_writev0; Java_sun_nio_ch_FileDispatcherImpl_readv0;
Java_sun_nio_ch_FileDispatcherImpl_release0;
Java_sun_nio_ch_FileDispatcherImpl_size0;
Java_sun_nio_ch_FileDispatcherImpl_truncate0;
Java_sun_nio_ch_FileDispatcherImpl_write0;
Java_sun_nio_ch_FileDispatcherImpl_writev0;
Java_sun_nio_ch_FileKey_init; Java_sun_nio_ch_FileKey_init;
Java_sun_nio_ch_FileKey_initIDs; Java_sun_nio_ch_FileKey_initIDs;
Java_sun_nio_ch_InheritedChannel_close0; Java_sun_nio_ch_InheritedChannel_close0;
...@@ -106,6 +106,75 @@ SUNWprivate_1.1 { ...@@ -106,6 +106,75 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_ServerSocketChannelImpl_accept0; Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
Java_sun_nio_ch_ServerSocketChannelImpl_initIDs; Java_sun_nio_ch_ServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_SocketChannelImpl_checkConnect; Java_sun_nio_ch_SocketChannelImpl_checkConnect;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
Java_sun_nio_ch_SolarisEventPort_init;
Java_sun_nio_ch_SolarisEventPort_portCreate;
Java_sun_nio_ch_SolarisEventPort_portClose;
Java_sun_nio_ch_SolarisEventPort_portAssociate;
Java_sun_nio_ch_SolarisEventPort_portGet;
Java_sun_nio_ch_SolarisEventPort_portGetn;
Java_sun_nio_ch_SolarisEventPort_portSend;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
Java_sun_nio_fs_UnixNativeDispatcher_initIDs;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
Java_sun_nio_fs_UnixNativeDispatcher_dup;
Java_sun_nio_fs_UnixNativeDispatcher_access0;
Java_sun_nio_fs_UnixNativeDispatcher_stat0;
Java_sun_nio_fs_UnixNativeDispatcher_lstat0;
Java_sun_nio_fs_UnixNativeDispatcher_fstat;
Java_sun_nio_fs_UnixNativeDispatcher_fstatat0;
Java_sun_nio_fs_UnixNativeDispatcher_chmod0;
Java_sun_nio_fs_UnixNativeDispatcher_fchmod;
Java_sun_nio_fs_UnixNativeDispatcher_chown0;
Java_sun_nio_fs_UnixNativeDispatcher_lchown0;
Java_sun_nio_fs_UnixNativeDispatcher_fchown;
Java_sun_nio_fs_UnixNativeDispatcher_utimes0;
Java_sun_nio_fs_UnixNativeDispatcher_futimes;
Java_sun_nio_fs_UnixNativeDispatcher_open0;
Java_sun_nio_fs_UnixNativeDispatcher_openat0;
Java_sun_nio_fs_UnixNativeDispatcher_close;
Java_sun_nio_fs_UnixNativeDispatcher_read;
Java_sun_nio_fs_UnixNativeDispatcher_write;
Java_sun_nio_fs_UnixNativeDispatcher_fopen0;
Java_sun_nio_fs_UnixNativeDispatcher_fclose;
Java_sun_nio_fs_UnixNativeDispatcher_opendir0;
Java_sun_nio_fs_UnixNativeDispatcher_fdopendir;
Java_sun_nio_fs_UnixNativeDispatcher_readdir;
Java_sun_nio_fs_UnixNativeDispatcher_closedir;
Java_sun_nio_fs_UnixNativeDispatcher_link0;
Java_sun_nio_fs_UnixNativeDispatcher_unlink0;
Java_sun_nio_fs_UnixNativeDispatcher_unlinkat0;
Java_sun_nio_fs_UnixNativeDispatcher_rename0;
Java_sun_nio_fs_UnixNativeDispatcher_renameat0;
Java_sun_nio_fs_UnixNativeDispatcher_mkdir0;
Java_sun_nio_fs_UnixNativeDispatcher_rmdir0;
Java_sun_nio_fs_UnixNativeDispatcher_symlink0;
Java_sun_nio_fs_UnixNativeDispatcher_readlink0;
Java_sun_nio_fs_UnixNativeDispatcher_realpath0;
Java_sun_nio_fs_UnixNativeDispatcher_statvfs0;
Java_sun_nio_fs_UnixNativeDispatcher_pathconf0;
Java_sun_nio_fs_UnixNativeDispatcher_fpathconf;
Java_sun_nio_fs_UnixNativeDispatcher_mknod0;
Java_sun_nio_fs_UnixNativeDispatcher_getpwuid;
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
Java_sun_nio_fs_UnixCopyFile_transfer;
Java_sun_nio_fs_SolarisNativeDispatcher_init;
Java_sun_nio_fs_SolarisNativeDispatcher_facl;
Java_sun_nio_fs_SolarisWatchService_init;
Java_sun_nio_fs_SolarisWatchService_portCreate;
Java_sun_nio_fs_SolarisWatchService_portAssociate;
Java_sun_nio_fs_SolarisWatchService_portDissociate;
Java_sun_nio_fs_SolarisWatchService_portSend;
Java_sun_nio_fs_SolarisWatchService_portGetn;
local: local:
*; *;
......
# #
# Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2004-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -31,7 +31,7 @@ BUILDDIR = ../.. ...@@ -31,7 +31,7 @@ BUILDDIR = ../..
PRODUCT = java PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = multicast server SUBDIRS = file multicast server
all build clean clobber:: all build clean clobber::
$(SUBDIRS-loop) $(SUBDIRS-loop)
......
#
# Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#
# Makefile for the nio/file sample code
#
BUILDDIR = ../../..
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk
SAMPLE_SRC_DIR = $(SHARE_SRC)/sample/nio/file
SAMPLE_DST_DIR = $(SAMPLEDIR)/nio/file
SAMPLE_FILES = \
$(SAMPLE_DST_DIR)/AclEdit.java \
$(SAMPLE_DST_DIR)/Chmod.java \
$(SAMPLE_DST_DIR)/Copy.java \
$(SAMPLE_DST_DIR)/DiskUsage.java \
$(SAMPLE_DST_DIR)/FileType.java \
$(SAMPLE_DST_DIR)/WatchDir.java \
$(SAMPLE_DST_DIR)/Xdd.java
all build: $(SAMPLE_FILES)
$(SAMPLE_DST_DIR)/%: $(SAMPLE_SRC_DIR)/%
$(install-file)
clean clobber:
$(RM) -r $(SAMPLE_DST_DIR)
.PHONY: all build clean clobber
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.nio.file;
import java.nio.file.CopyOption;
/**
* Defines <em>extended</em> copy options supported on some platforms
* by Sun's provider implementation.
*
* @since 1.7
*/
public enum ExtendedCopyOption implements CopyOption {
/**
* The copy may be interrupted by the {@link Thread#interrupt interrupt}
* method.
*/
INTERRUPTIBLE,
}
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.nio.file;
import java.nio.file.OpenOption;
/**
* Defines <em>extended</em> open options supported on some platforms
* by Sun's provider implementation.
*
* @since 1.7
*/
public enum ExtendedOpenOption implements OpenOption {
/**
* Prevent operations on the file that request read access.
*/
NOSHARE_READ,
/**
* Prevent operations on the file that request write access.
*/
NOSHARE_WRITE,
/**
* Prevent operations on the file that request delete access.
*/
NOSHARE_DELETE;
}
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.nio.file;
import java.nio.file.WatchEvent.Modifier;
/**
* Defines <em>extended</em> watch event modifiers supported on some platforms
* by Sun's provider implementation.
*
* @since 1.7
*/
public enum ExtendedWatchEventModifier implements Modifier {
/**
* Register a file tree instead of a single directory.
*/
FILE_TREE,
}
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.nio.file;
import java.nio.file.WatchEvent.Modifier;
/**
* Defines the <em>sensitivity levels</em> when registering objects with a
* watch service implementation that polls the file system.
*
* @since 1.7
*/
public enum SensitivityWatchEventModifier implements Modifier {
/**
* High sensitivity.
*/
HIGH(2),
/**
* Medium sensitivity.
*/
MEDIUM(10),
/**
* Low sensitivity.
*/
LOW(30);
/**
* Returns the sensitivity in seconds.
*/
public int sensitivityValueInSeconds() {
return sensitivity;
}
private final int sensitivity;
private SensitivityWatchEventModifier(int sensitivity) {
this.sensitivity = sensitivity;
}
}
此差异已折叠。
/* /*
* Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -29,7 +29,6 @@ import java.security.*; ...@@ -29,7 +29,6 @@ import java.security.*;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Vector; import java.util.Vector;
import java.util.Collections; import java.util.Collections;
import java.io.ObjectStreamField; import java.io.ObjectStreamField;
...@@ -58,7 +57,8 @@ import sun.security.util.SecurityConstants; ...@@ -58,7 +57,8 @@ import sun.security.util.SecurityConstants;
* <P> * <P>
* The actions to be granted are passed to the constructor in a string containing * The actions to be granted are passed to the constructor in a string containing
* a list of one or more comma-separated keywords. The possible keywords are * a list of one or more comma-separated keywords. The possible keywords are
* "read", "write", "execute", and "delete". Their meaning is defined as follows: * "read", "write", "execute", "delete", and "readlink". Their meaning is
* defined as follows:
* <P> * <P>
* <DL> * <DL>
* <DT> read <DD> read permission * <DT> read <DD> read permission
...@@ -69,6 +69,11 @@ import sun.security.util.SecurityConstants; ...@@ -69,6 +69,11 @@ import sun.security.util.SecurityConstants;
* <DT> delete * <DT> delete
* <DD> delete permission. Allows <code>File.delete</code> to * <DD> delete permission. Allows <code>File.delete</code> to
* be called. Corresponds to <code>SecurityManager.checkDelete</code>. * be called. Corresponds to <code>SecurityManager.checkDelete</code>.
* <DT> readlink
* <DD> read link permission. Allows the target of a
* <a href="../nio/file/package-summary.html#links">symbolic link</a>
* to be read by invoking the {@link java.nio.file.Path#readSymbolicLink
* readSymbolicLink } method.
* </DL> * </DL>
* <P> * <P>
* The actions string is converted to lowercase before processing. * The actions string is converted to lowercase before processing.
...@@ -114,11 +119,15 @@ public final class FilePermission extends Permission implements Serializable { ...@@ -114,11 +119,15 @@ public final class FilePermission extends Permission implements Serializable {
* Delete action. * Delete action.
*/ */
private final static int DELETE = 0x8; private final static int DELETE = 0x8;
/**
* Read link action.
*/
private final static int READLINK = 0x10;
/** /**
* All actions (read,write,execute,delete) * All actions (read,write,execute,delete,readlink)
*/ */
private final static int ALL = READ|WRITE|EXECUTE|DELETE; private final static int ALL = READ|WRITE|EXECUTE|DELETE|READLINK;
/** /**
* No actions. * No actions.
*/ */
...@@ -235,7 +244,7 @@ public final class FilePermission extends Permission implements Serializable { ...@@ -235,7 +244,7 @@ public final class FilePermission extends Permission implements Serializable {
* <i>path</i> is the pathname of a file or directory, and <i>actions</i> * <i>path</i> is the pathname of a file or directory, and <i>actions</i>
* contains a comma-separated list of the desired actions granted on the * contains a comma-separated list of the desired actions granted on the
* file or directory. Possible actions are * file or directory. Possible actions are
* "read", "write", "execute", and "delete". * "read", "write", "execute", "delete", and "readlink".
* *
* <p>A pathname that ends in "/*" (where "/" is * <p>A pathname that ends in "/*" (where "/" is
* the file separator character, <code>File.separatorChar</code>) * the file separator character, <code>File.separatorChar</code>)
...@@ -425,6 +434,8 @@ public final class FilePermission extends Permission implements Serializable { ...@@ -425,6 +434,8 @@ public final class FilePermission extends Permission implements Serializable {
return EXECUTE; return EXECUTE;
} else if (actions == SecurityConstants.FILE_DELETE_ACTION) { } else if (actions == SecurityConstants.FILE_DELETE_ACTION) {
return DELETE; return DELETE;
} else if (actions == SecurityConstants.FILE_READLINK_ACTION) {
return READLINK;
} }
char[] a = actions.toCharArray(); char[] a = actions.toCharArray();
...@@ -485,6 +496,18 @@ public final class FilePermission extends Permission implements Serializable { ...@@ -485,6 +496,18 @@ public final class FilePermission extends Permission implements Serializable {
matchlen = 6; matchlen = 6;
mask |= DELETE; mask |= DELETE;
} else if (i >= 7 && (a[i-7] == 'r' || a[i-7] == 'R') &&
(a[i-6] == 'e' || a[i-6] == 'E') &&
(a[i-5] == 'a' || a[i-5] == 'A') &&
(a[i-4] == 'd' || a[i-4] == 'D') &&
(a[i-3] == 'l' || a[i-3] == 'L') &&
(a[i-2] == 'i' || a[i-2] == 'I') &&
(a[i-1] == 'n' || a[i-1] == 'N') &&
(a[i] == 'k' || a[i] == 'K'))
{
matchlen = 8;
mask |= READLINK;
} else { } else {
// parse error // parse error
throw new IllegalArgumentException( throw new IllegalArgumentException(
...@@ -529,7 +552,7 @@ public final class FilePermission extends Permission implements Serializable { ...@@ -529,7 +552,7 @@ public final class FilePermission extends Permission implements Serializable {
/** /**
* Return the canonical string representation of the actions. * Return the canonical string representation of the actions.
* Always returns present actions in the following order: * Always returns present actions in the following order:
* read, write, execute, delete. * read, write, execute, delete, readlink.
* *
* @return the canonical string representation of the actions. * @return the canonical string representation of the actions.
*/ */
...@@ -561,14 +584,20 @@ public final class FilePermission extends Permission implements Serializable { ...@@ -561,14 +584,20 @@ public final class FilePermission extends Permission implements Serializable {
sb.append("delete"); sb.append("delete");
} }
if ((mask & READLINK) == READLINK) {
if (comma) sb.append(',');
else comma = true;
sb.append("readlink");
}
return sb.toString(); return sb.toString();
} }
/** /**
* Returns the "canonical string representation" of the actions. * Returns the "canonical string representation" of the actions.
* That is, this method always returns present actions in the following order: * That is, this method always returns present actions in the following order:
* read, write, execute, delete. For example, if this FilePermission object * read, write, execute, delete, readlink. For example, if this FilePermission
* allows both write and read actions, a call to <code>getActions</code> * object allows both write and read actions, a call to <code>getActions</code>
* will return the string "read,write". * will return the string "read,write".
* *
* @return the canonical string representation of the actions. * @return the canonical string representation of the actions.
...@@ -678,7 +707,7 @@ final class FilePermissionCollection extends PermissionCollection ...@@ -678,7 +707,7 @@ final class FilePermissionCollection extends PermissionCollection
implements Serializable { implements Serializable {
// Not serialized; see serialization section at end of class // Not serialized; see serialization section at end of class
private transient List perms; private transient List<Permission> perms;
/** /**
* Create an empty FilePermissions object. * Create an empty FilePermissions object.
...@@ -686,7 +715,7 @@ implements Serializable { ...@@ -686,7 +715,7 @@ implements Serializable {
*/ */
public FilePermissionCollection() { public FilePermissionCollection() {
perms = new ArrayList(); perms = new ArrayList<Permission>();
} }
/** /**
...@@ -791,7 +820,7 @@ implements Serializable { ...@@ -791,7 +820,7 @@ implements Serializable {
// Don't call out.defaultWriteObject() // Don't call out.defaultWriteObject()
// Write out Vector // Write out Vector
Vector permissions = new Vector(perms.size()); Vector<Permission> permissions = new Vector<Permission>(perms.size());
synchronized (this) { synchronized (this) {
permissions.addAll(perms); permissions.addAll(perms);
} }
...@@ -804,6 +833,7 @@ implements Serializable { ...@@ -804,6 +833,7 @@ implements Serializable {
/* /*
* Reads in a Vector of FilePermissions and saves them in the perms field. * Reads in a Vector of FilePermissions and saves them in the perms field.
*/ */
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws IOException, private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException { ClassNotFoundException {
// Don't call defaultReadObject() // Don't call defaultReadObject()
...@@ -812,8 +842,8 @@ implements Serializable { ...@@ -812,8 +842,8 @@ implements Serializable {
ObjectInputStream.GetField gfields = in.readFields(); ObjectInputStream.GetField gfields = in.readFields();
// Get the one we want // Get the one we want
Vector permissions = (Vector)gfields.get("permissions", null); Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
perms = new ArrayList(permissions.size()); perms = new ArrayList<Permission>(permissions.size());
perms.addAll(permissions); perms.addAll(permissions);
} }
} }
...@@ -25,13 +25,17 @@ ...@@ -25,13 +25,17 @@
package java.lang; package java.lang;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.security.AccessController; import java.security.AccessController;
import java.security.AccessControlContext; import java.security.AccessControlContext;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.LockSupport;
import sun.misc.SoftCache;
import sun.nio.ch.Interruptible; import sun.nio.ch.Interruptible;
import sun.security.util.SecurityConstants; import sun.security.util.SecurityConstants;
...@@ -1640,8 +1644,17 @@ class Thread implements Runnable { ...@@ -1640,8 +1644,17 @@ class Thread implements Runnable {
new RuntimePermission("enableContextClassLoaderOverride"); new RuntimePermission("enableContextClassLoaderOverride");
/** cache of subclass security audit results */ /** cache of subclass security audit results */
private static final SoftCache subclassAudits = new SoftCache(10); /* Replace with ConcurrentReferenceHashMap when/if it appears in a future
* release */
private static class Caches {
/** cache of subclass security audit results */
static final ConcurrentMap<WeakClassKey,Boolean> subclassAudits =
new ConcurrentHashMap<WeakClassKey,Boolean>();
/** queue for WeakReferences to audited subclasses */
static final ReferenceQueue<Class<?>> subclassAuditsQueue =
new ReferenceQueue<Class<?>>();
}
/** /**
* Verifies that this (possibly subclass) instance can be constructed * Verifies that this (possibly subclass) instance can be constructed
...@@ -1652,19 +1665,15 @@ class Thread implements Runnable { ...@@ -1652,19 +1665,15 @@ class Thread implements Runnable {
private static boolean isCCLOverridden(Class cl) { private static boolean isCCLOverridden(Class cl) {
if (cl == Thread.class) if (cl == Thread.class)
return false; return false;
Boolean result = null;
synchronized (subclassAudits) { processQueue(Caches.subclassAuditsQueue, Caches.subclassAudits);
result = (Boolean) subclassAudits.get(cl); WeakClassKey key = new WeakClassKey(cl, Caches.subclassAuditsQueue);
Boolean result = Caches.subclassAudits.get(key);
if (result == null) { if (result == null) {
/* result = Boolean.valueOf(auditSubclass(cl));
* Note: only new Boolean instances (i.e., not Boolean.TRUE or Caches.subclassAudits.putIfAbsent(key, result);
* Boolean.FALSE) must be used as cache values, otherwise cache
* entry will pin associated class.
*/
result = new Boolean(auditSubclass(cl));
subclassAudits.put(cl, result);
}
} }
return result.booleanValue(); return result.booleanValue();
} }
...@@ -1967,6 +1976,68 @@ class Thread implements Runnable { ...@@ -1967,6 +1976,68 @@ class Thread implements Runnable {
getUncaughtExceptionHandler().uncaughtException(this, e); getUncaughtExceptionHandler().uncaughtException(this, e);
} }
/**
* Removes from the specified map any keys that have been enqueued
* on the specified reference queue.
*/
static void processQueue(ReferenceQueue<Class<?>> queue,
ConcurrentMap<? extends
WeakReference<Class<?>>, ?> map)
{
Reference<? extends Class<?>> ref;
while((ref = queue.poll()) != null) {
map.remove(ref);
}
}
/**
* Weak key for Class objects.
**/
static class WeakClassKey extends WeakReference<Class<?>> {
/**
* saved value of the referent's identity hash code, to maintain
* a consistent hash code after the referent has been cleared
*/
private final int hash;
/**
* Create a new WeakClassKey to the given object, registered
* with a queue.
*/
WeakClassKey(Class<?> cl, ReferenceQueue<Class<?>> refQueue) {
super(cl, refQueue);
hash = System.identityHashCode(cl);
}
/**
* Returns the identity hash code of the original referent.
*/
@Override
public int hashCode() {
return hash;
}
/**
* Returns true if the given object is this identical
* WeakClassKey instance, or, if this object's referent has not
* been cleared, if the given object is another WeakClassKey
* instance with the identical non-null referent as this one.
*/
@Override
public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj instanceof WeakClassKey) {
Object referent = get();
return (referent != null) &&
(referent == ((WeakClassKey) obj).get());
} else {
return false;
}
}
}
/* Some private helper methods */ /* Some private helper methods */
private native void setPriority0(int newPriority); private native void setPriority0(int newPriority);
private native void stop0(Object o); private native void stop0(Object o);
......
/* /*
* Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
package java.net; package java.net;
/** /**
* Defines the standard family of communication protocols. * Defines the standard families of communication protocols.
* *
* @since 1.7 * @since 1.7
*/ */
......
/* /*
* Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -59,6 +59,7 @@ public final class StandardSocketOption { ...@@ -59,6 +59,7 @@ public final class StandardSocketOption {
* *
* @see <a href="http://www.ietf.org/rfc/rfc919.txt">RFC&nbsp;929: * @see <a href="http://www.ietf.org/rfc/rfc919.txt">RFC&nbsp;929:
* Broadcasting Internet Datagrams</a> * Broadcasting Internet Datagrams</a>
* @see DatagramSocket#setBroadcast
*/ */
public static final SocketOption<Boolean> SO_BROADCAST = public static final SocketOption<Boolean> SO_BROADCAST =
new StdSocketOption<Boolean>("SO_BROADCAST", Boolean.class); new StdSocketOption<Boolean>("SO_BROADCAST", Boolean.class);
...@@ -78,6 +79,7 @@ public final class StandardSocketOption { ...@@ -78,6 +79,7 @@ public final class StandardSocketOption {
* *
* @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122 * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122
* Requirements for Internet Hosts -- Communication Layers</a> * Requirements for Internet Hosts -- Communication Layers</a>
* @see Socket#setKeepAlive
*/ */
public static final SocketOption<Boolean> SO_KEEPALIVE = public static final SocketOption<Boolean> SO_KEEPALIVE =
new StdSocketOption<Boolean>("SO_KEEPALIVE", Boolean.class); new StdSocketOption<Boolean>("SO_KEEPALIVE", Boolean.class);
...@@ -107,6 +109,8 @@ public final class StandardSocketOption { ...@@ -107,6 +109,8 @@ public final class StandardSocketOption {
* socket is bound or connected. Whether an implementation allows the * socket is bound or connected. Whether an implementation allows the
* socket send buffer to be changed after the socket is bound is system * socket send buffer to be changed after the socket is bound is system
* dependent. * dependent.
*
* @see Socket#setSendBufferSize
*/ */
public static final SocketOption<Integer> SO_SNDBUF = public static final SocketOption<Integer> SO_SNDBUF =
new StdSocketOption<Integer>("SO_SNDBUF", Integer.class); new StdSocketOption<Integer>("SO_SNDBUF", Integer.class);
...@@ -145,6 +149,8 @@ public final class StandardSocketOption { ...@@ -145,6 +149,8 @@ public final class StandardSocketOption {
* *
* @see <a href="http://www.ietf.org/rfc/rfc1323.txt">RFC&nbsp;1323: TCP * @see <a href="http://www.ietf.org/rfc/rfc1323.txt">RFC&nbsp;1323: TCP
* Extensions for High Performance</a> * Extensions for High Performance</a>
* @see Socket#setReceiveBufferSize
* @see ServerSocket#setReceiveBufferSize
*/ */
public static final SocketOption<Integer> SO_RCVBUF = public static final SocketOption<Integer> SO_RCVBUF =
new StdSocketOption<Integer>("SO_RCVBUF", Integer.class); new StdSocketOption<Integer>("SO_RCVBUF", Integer.class);
...@@ -175,6 +181,7 @@ public final class StandardSocketOption { ...@@ -175,6 +181,7 @@ public final class StandardSocketOption {
* *
* @see <a href="http://www.ietf.org/rfc/rfc793.txt">RFC&nbsp;793: Transmission * @see <a href="http://www.ietf.org/rfc/rfc793.txt">RFC&nbsp;793: Transmission
* Control Protocol</a> * Control Protocol</a>
* @see ServerSocket#setReuseAddress
*/ */
public static final SocketOption<Boolean> SO_REUSEADDR = public static final SocketOption<Boolean> SO_REUSEADDR =
new StdSocketOption<Boolean>("SO_REUSEADDR", Boolean.class); new StdSocketOption<Boolean>("SO_REUSEADDR", Boolean.class);
...@@ -205,6 +212,8 @@ public final class StandardSocketOption { ...@@ -205,6 +212,8 @@ public final class StandardSocketOption {
* is system dependent. Setting the linger interval to a value that is * is system dependent. Setting the linger interval to a value that is
* greater than its maximum value causes the linger interval to be set to * greater than its maximum value causes the linger interval to be set to
* its maximum value. * its maximum value.
*
* @see Socket#setSoLinger
*/ */
public static final SocketOption<Integer> SO_LINGER = public static final SocketOption<Integer> SO_LINGER =
new StdSocketOption<Integer>("SO_LINGER", Integer.class); new StdSocketOption<Integer>("SO_LINGER", Integer.class);
...@@ -215,15 +224,15 @@ public final class StandardSocketOption { ...@@ -215,15 +224,15 @@ public final class StandardSocketOption {
/** /**
* The Type of Service (ToS) octet in the Internet Protocol (IP) header. * The Type of Service (ToS) octet in the Internet Protocol (IP) header.
* *
* <p> The value of this socket option is an {@code Integer}, the least * <p> The value of this socket option is an {@code Integer} representing
* significant 8 bits of which represents the value of the ToS octet in IP * the value of the ToS octet in IP packets sent by sockets to an {@link
* packets sent by sockets to an {@link StandardProtocolFamily#INET IPv4} * StandardProtocolFamily#INET IPv4} socket. The interpretation of the ToS
* socket. The interpretation of the ToS octet is network specific and * octet is network specific and is not defined by this class. Further
* is not defined by this class. Further information on the ToS octet can be * information on the ToS octet can be found in <a
* found in <a href="http://www.ietf.org/rfc/rfc1349.txt">RFC&nbsp;1349</a> * href="http://www.ietf.org/rfc/rfc1349.txt">RFC&nbsp;1349</a> and <a
* and <a href="http://www.ietf.org/rfc/rfc2474.txt">RFC&nbsp;2474</a>. The * href="http://www.ietf.org/rfc/rfc2474.txt">RFC&nbsp;2474</a>. The value
* value of the socket option is a <em>hint</em>. An implementation may * of the socket option is a <em>hint</em>. An implementation may ignore the
* ignore the value, or ignore specific values. * value, or ignore specific values.
* *
* <p> The initial/default value of the TOS field in the ToS octet is * <p> The initial/default value of the TOS field in the ToS octet is
* implementation specific but will typically be {@code 0}. For * implementation specific but will typically be {@code 0}. For
...@@ -235,6 +244,8 @@ public final class StandardSocketOption { ...@@ -235,6 +244,8 @@ public final class StandardSocketOption {
* <p> The behavior of this socket option on a stream-oriented socket, or an * <p> The behavior of this socket option on a stream-oriented socket, or an
* {@link StandardProtocolFamily#INET6 IPv6} socket, is not defined in this * {@link StandardProtocolFamily#INET6 IPv6} socket, is not defined in this
* release. * release.
*
* @see DatagramSocket#setTrafficClass
*/ */
public static final SocketOption<Integer> IP_TOS = public static final SocketOption<Integer> IP_TOS =
new StdSocketOption<Integer>("IP_TOS", Integer.class); new StdSocketOption<Integer>("IP_TOS", Integer.class);
...@@ -257,6 +268,7 @@ public final class StandardSocketOption { ...@@ -257,6 +268,7 @@ public final class StandardSocketOption {
* is system dependent. * is system dependent.
* *
* @see java.nio.channels.MulticastChannel * @see java.nio.channels.MulticastChannel
* @see MulticastSocket#setInterface
*/ */
public static final SocketOption<NetworkInterface> IP_MULTICAST_IF = public static final SocketOption<NetworkInterface> IP_MULTICAST_IF =
new StdSocketOption<NetworkInterface>("IP_MULTICAST_IF", NetworkInterface.class); new StdSocketOption<NetworkInterface>("IP_MULTICAST_IF", NetworkInterface.class);
...@@ -283,6 +295,7 @@ public final class StandardSocketOption { ...@@ -283,6 +295,7 @@ public final class StandardSocketOption {
* prior to binding the socket is system dependent. * prior to binding the socket is system dependent.
* *
* @see java.nio.channels.MulticastChannel * @see java.nio.channels.MulticastChannel
* @see MulticastSocket#setTimeToLive
*/ */
public static final SocketOption<Integer> IP_MULTICAST_TTL = public static final SocketOption<Integer> IP_MULTICAST_TTL =
new StdSocketOption<Integer>("IP_MULTICAST_TTL", Integer.class); new StdSocketOption<Integer>("IP_MULTICAST_TTL", Integer.class);
...@@ -307,6 +320,7 @@ public final class StandardSocketOption { ...@@ -307,6 +320,7 @@ public final class StandardSocketOption {
* binding the socket is system dependent. * binding the socket is system dependent.
* *
* @see java.nio.channels.MulticastChannel * @see java.nio.channels.MulticastChannel
* @see MulticastSocket#setLoopbackMode
*/ */
public static final SocketOption<Boolean> IP_MULTICAST_LOOP = public static final SocketOption<Boolean> IP_MULTICAST_LOOP =
new StdSocketOption<Boolean>("IP_MULTICAST_LOOP", Boolean.class); new StdSocketOption<Boolean>("IP_MULTICAST_LOOP", Boolean.class);
...@@ -328,11 +342,12 @@ public final class StandardSocketOption { ...@@ -328,11 +342,12 @@ public final class StandardSocketOption {
* coalescing impacts performance. The socket option may be enabled at any * coalescing impacts performance. The socket option may be enabled at any
* time. In other words, the Nagle Algorithm can be disabled. Once the option * time. In other words, the Nagle Algorithm can be disabled. Once the option
* is enabled, it is system dependent whether it can be subsequently * is enabled, it is system dependent whether it can be subsequently
* disabled. In that case, invoking the {@code setOption} method to disable * disabled. If it cannot, then invoking the {@code setOption} method to
* the option has no effect. * disable the option has no effect.
* *
* @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122: * @see <a href="http://www.ietf.org/rfc/rfc1122.txt">RFC&nbsp;1122:
* Requirements for Internet Hosts -- Communication Layers</a> * Requirements for Internet Hosts -- Communication Layers</a>
* @see Socket#setTcpNoDelay
*/ */
public static final SocketOption<Boolean> TCP_NODELAY = public static final SocketOption<Boolean> TCP_NODELAY =
new StdSocketOption<Boolean>("TCP_NODELAY", Boolean.class); new StdSocketOption<Boolean>("TCP_NODELAY", Boolean.class);
......
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package java.nio.channels;
import java.nio.ByteBuffer;
import java.util.concurrent.Future;
/**
* An asynchronous channel that can read and write bytes.
*
* <p> Some channels may not allow more than one read or write to be outstanding
* at any given time. If a thread invokes a read method before a previous read
* operation has completed then a {@link ReadPendingException} will be thrown.
* Similarly, if a write method is invoked before a previous write has completed
* then {@link WritePendingException} is thrown. Whether or not other kinds of
* I/O operations may proceed concurrently with a read operation depends upon
* the type of the channel.
*
* <p> Note that {@link java.nio.ByteBuffer ByteBuffers} are not safe for use by
* multiple concurrent threads. When a read or write operation is initiated then
* care must be taken to ensure that the buffer is not accessed until the
* operation completes.
*
* @see Channels#newInputStream(AsynchronousByteChannel)
* @see Channels#newOutputStream(AsynchronousByteChannel)
*
* @since 1.7
*/
public interface AsynchronousByteChannel
extends AsynchronousChannel
{
/**
* Reads a sequence of bytes from this channel into the given buffer.
*
* <p> This method initiates an operation to read a sequence of bytes from
* this channel into the given buffer. The method returns a {@link Future}
* representing the pending result of the operation. The result of the
* operation, obtained by invoking the {@code Future} 's {@link
* Future#get() get} method, is the number of bytes read or {@code -1} if
* all bytes have been read and the channel has reached end-of-stream.
*
* <p> This method initiates a read operation to read up to <i>r</i> bytes
* from the channel, where <i>r</i> is the number of bytes remaining in the
* buffer, that is, {@code dst.remaining()} at the time that the read is
* attempted. Where <i>r</i> is 0, the read operation completes immediately
* with a result of {@code 0} without initiating an I/O operation.
*
* <p> Suppose that a byte sequence of length <i>n</i> is read, where
* <tt>0</tt>&nbsp;<tt>&lt;</tt>&nbsp;<i>n</i>&nbsp;<tt>&lt;=</tt>&nbsp;<i>r</i>.
* This byte sequence will be transferred into the buffer so that the first
* byte in the sequence is at index <i>p</i> and the last byte is at index
* <i>p</i>&nbsp;<tt>+</tt>&nbsp;<i>n</i>&nbsp;<tt>-</tt>&nbsp;<tt>1</tt>,
* where <i>p</i> is the buffer's position at the moment the read is
* performed. Upon completion the buffer's position will be equal to
* <i>p</i>&nbsp;<tt>+</tt>&nbsp;<i>n</i>; its limit will not have changed.
*
* <p> Buffers are not safe for use by multiple concurrent threads so care
* should be taken to not to access the buffer until the operaton has completed.
*
* <p> This method may be invoked at any time. Some channel types may not
* allow more than one read to be outstanding at any given time. If a thread
* initiates a read operation before a previous read operation has
* completed then a {@link ReadPendingException} will be thrown.
*
* <p> The <tt>handler</tt> parameter is used to specify a {@link
* CompletionHandler}. When the read operation completes the handler's
* {@link CompletionHandler#completed completed} method is executed.
*
*
* @param dst
* The buffer into which bytes are to be transferred
* @param attachment
* The object to attach to the I/O operation; can be {@code null}
* @param handler
* The completion handler object; can be {@code null}
*
* @return A Future representing the result of the operation
*
* @throws IllegalArgumentException
* If the buffer is read-only
* @throws ReadPendingException
* If the channel does not allow more than one read to be outstanding
* and a previous read has not completed
*/
<A> Future<Integer> read(ByteBuffer dst,
A attachment,
CompletionHandler<Integer,? super A> handler);
/**
* Reads a sequence of bytes from this channel into the given buffer.
*
* <p> An invocation of this method of the form <tt>c.read(dst)</tt>
* behaves in exactly the same manner as the invocation
* <blockquote><pre>
* c.read(dst, null, null);</pre></blockquote>
*
* @param dst
* The buffer into which bytes are to be transferred
*
* @return A Future representing the result of the operation
*
* @throws IllegalArgumentException
* If the buffer is read-only
* @throws ReadPendingException
* If the channel does not allow more than one read to be outstanding
* and a previous read has not completed
*/
Future<Integer> read(ByteBuffer dst);
/**
* Writes a sequence of bytes to this channel from the given buffer.
*
* <p> This method initiates an operation to write a sequence of bytes to
* this channel from the given buffer. This method returns a {@link
* Future} representing the pending result of the operation. The result
* of the operation, obtained by invoking the <tt>Future</tt>'s {@link
* Future#get() get} method, is the number of bytes written, possibly zero.
*
* <p> This method initiates a write operation to write up to <i>r</i> bytes
* to the channel, where <i>r</i> is the number of bytes remaining in the
* buffer, that is, {@code src.remaining()} at the moment the write is
* attempted. Where <i>r</i> is 0, the write operation completes immediately
* with a result of {@code 0} without initiating an I/O operation.
*
* <p> Suppose that a byte sequence of length <i>n</i> is written, where
* <tt>0</tt>&nbsp;<tt>&lt;</tt>&nbsp;<i>n</i>&nbsp;<tt>&lt;=</tt>&nbsp;<i>r</i>.
* This byte sequence will be transferred from the buffer starting at index
* <i>p</i>, where <i>p</i> is the buffer's position at the moment the
* write is performed; the index of the last byte written will be
* <i>p</i>&nbsp;<tt>+</tt>&nbsp;<i>n</i>&nbsp;<tt>-</tt>&nbsp;<tt>1</tt>.
* Upon completion the buffer's position will be equal to
* <i>p</i>&nbsp;<tt>+</tt>&nbsp;<i>n</i>; its limit will not have changed.
*
* <p> Buffers are not safe for use by multiple concurrent threads so care
* should be taken to not to access the buffer until the operaton has completed.
*
* <p> This method may be invoked at any time. Some channel types may not
* allow more than one write to be outstanding at any given time. If a thread
* initiates a write operation before a previous write operation has
* completed then a {@link WritePendingException} will be thrown.
*
* <p> The <tt>handler</tt> parameter is used to specify a {@link
* CompletionHandler}. When the write operation completes the handler's
* {@link CompletionHandler#completed completed} method is executed.
*
* @param src
* The buffer from which bytes are to be retrieved
* @param attachment
* The object to attach to the I/O operation; can be {@code null}
* @param handler
* The completion handler object; can be {@code null}
*
* @return A Future representing the result of the operation
*
* @throws WritePendingException
* If the channel does not allow more than one write to be outstanding
* and a previous write has not completed
*/
<A> Future<Integer> write(ByteBuffer src,
A attachment,
CompletionHandler<Integer,? super A> handler);
/**
* Writes a sequence of bytes to this channel from the given buffer.
*
* <p> An invocation of this method of the form <tt>c.write(src)</tt>
* behaves in exactly the same manner as the invocation
* <blockquote><pre>
* c.write(src, null, null);</pre></blockquote>
*
* @param src
* The buffer from which bytes are to be retrieved
*
* @return A Future representing the result of the operation
*
* @throws WritePendingException
* If the channel does not allow more than one write to be outstanding
* and a previous write has not completed
*/
Future<Integer> write(ByteBuffer src);
}
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package java.nio.channels;
import java.io.IOException;
import java.util.concurrent.Future; // javadoc
/**
* A channel that supports asynchronous I/O operations. Asynchronous I/O
* operations will usually take one of two forms:
*
* <ol>
* <li><pre>{@link Future}&lt;V&gt; <em>operation</em>(<em>...</em>)</pre></li>
* <li><pre>Future&lt;V&gt; <em>operation</em>(<em>...</em> A attachment, {@link CompletionHandler}&lt;V,? super A&gt handler)</pre></li>
* </ol>
*
* where <i>operation</i> is the name of the I/O operation (read or write for
* example), <i>V</i> is the result type of the I/O operation, and <i>A</i> is
* the type of an object attached to the I/O operation to provide context when
* consuming the result. The attachment is important for cases where a
* <em>state-less</em> {@code CompletionHandler} is used to consume the result
* of many I/O operations.
*
* <p> In the first form, the methods defined by the {@link Future Future}
* interface may be used to check if the operation has completed, wait for its
* completion, and to retrieve the result. In the second form, a {@link
* CompletionHandler} is invoked to consume the result of the I/O operation when
* it completes, fails, or is cancelled.
*
* <p> A channel that implements this interface is <em>asynchronously
* closeable</em>: If an I/O operation is outstanding on the channel and the
* channel's {@link #close close} method is invoked, then the I/O operation
* fails with the exception {@link AsynchronousCloseException}.
*
* <p> Asynchronous channels are safe for use by multiple concurrent threads.
* Some channel implementations may support concurrent reading and writing, but
* may not allow more than one read and one write operation to be outstanding at
* any given time.
*
* <h4>Cancellation</h4>
*
* <p> The {@code Future} interface defines the {@link Future#cancel cancel}
* method to cancel execution of a task.
*
* <p> Where the {@code cancel} method is invoked with the {@code
* mayInterruptIfRunning} parameter set to {@code true} then the I/O operation
* may be interrupted by closing the channel. This will cause any other I/O
* operations outstanding on the channel to complete with the exception {@link
* AsynchronousCloseException}.
*
* <p> If a {@code CompletionHandler} is specified when initiating an I/O
* operation, and the {@code cancel} method is invoked to cancel the I/O
* operation before it completes, then the {@code CompletionHandler}'s {@link
* CompletionHandler#cancelled cancelled} method is invoked.
*
* <p> If an implementation of this interface supports a means to cancel I/O
* operations, and where cancellation may leave the channel, or the entity to
* which it is connected, in an inconsistent state, then the channel is put into
* an implementation specific <em>error state</em> that prevents further
* attempts to initiate I/O operations on the channel. For example, if a read
* operation is cancelled but the implementation cannot guarantee that bytes
* have not been read from the channel then it puts the channel into error state
* state; further attempts to initiate a {@code read} operation causes an
* unspecified runtime exception to be thrown.
*
* <p> Where the {@code cancel} method is invoked to cancel read or write
* operations then it recommended that all buffers used in the I/O operations be
* discarded or care taken to ensure that the buffers are not accessed while the
* channel remains open.
*
* @since 1.7
*/
public interface AsynchronousChannel
extends Channel
{
/**
* Closes this channel.
*
* <p> Any outstanding asynchronous operations upon this channel will
* complete with the exception {@link AsynchronousCloseException}. After a
* channel is closed then further attempts to initiate asynchronous I/O
* operations complete immediately with cause {@link ClosedChannelException}.
*
* <p> This method otherwise behaves exactly as specified by the {@link
* Channel} interface.
*
* @throws IOException
* If an I/O error occurs
*/
@Override
void close() throws IOException;
}
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package java.nio.channels;
import java.nio.channels.spi.AsynchronousChannelProvider;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
/**
* A grouping of asynchronous channels for the purpose of resource sharing.
*
* <p> An asynchronous channel group encapsulates the mechanics required to
* handle the completion of I/O operations initiated by {@link AsynchronousChannel
* asynchronous channels} that are bound to the group. A group has an associated
* thread pool to which tasks are submitted to handle I/O events and dispatch to
* {@link CompletionHandler completion-handlers} that consume the result of
* asynchronous operations performed on channels in the group. In addition to
* handling I/O events, the pooled threads may also execute other tasks required
* to support the execution of asynchronous I/O operations.
*
* <p> An asynchronous channel group is created by invoking the {@link
* #withFixedThreadPool withFixedThreadPool} or {@link #withCachedThreadPool
* withCachedThreadPool} methods defined here. Channels are bound to a group by
* specifying the group when constructing the channel. The associated thread
* pool is <em>owned</em> by the group; termination of the group results in the
* shutdown of the associated thread pool.
*
* <p> In addition to groups created explicitly, the Java virtual machine
* maintains a system-wide <em>default group</em> that is constructed
* automatically. Asynchronous channels that do not specify a group at
* construction time are bound to the default group. The default group has an
* associated thread pool that creates new threads as needed. The default group
* may be configured by means of system properties defined in the table below.
* Where the {@link java.util.concurrent.ThreadFactory ThreadFactory} for the
* default group is not configured then the pooled threads of the default group
* are {@link Thread#isDaemon daemon} threads.
*
* <table border>
* <tr>
* <th>System property</th>
* <th>Description</th>
* </tr>
* <tr>
* <tr>
* <td> {@code java.nio.channels.DefaultThreadPool.threadFactory} </td>
* <td> The value of this property is taken to be the fully-qualified name
* of a concrete {@link java.util.concurrent.ThreadFactory ThreadFactory}
* class. The class is loaded using the system class loader and instantiated.
* The factory's {@link java.util.concurrent.ThreadFactory#newThread
* newThread} method is invoked to create each thread for the default
* group's thread pool. If the process to load and instantiate the value
* of the property fails then an unspecified error is thrown during the
* construction of the default group. </td>
* </tr>
* <tr>
* <td> {@code java.nio.channels.DefaultThreadPool.initialSize} </td>
* <td> The value of the {@code initialSize} parameter for the default
* group (see {@link #withCachedThreadPool withCachedThreadPool}).
* The value of the property is taken to be the {@code String}
* representation of an {@code Integer} that is the initial size parameter.
* If the value cannot be parsed as an {@code Integer} it causes an
* unspecified error to be thrown during the construction of the default
* group. </td>
* </tr>
* </table>
*
* <a name="threading"><h4>Threading</h4></a>
*
* <p> The completion handler for an I/O operation initiated on a channel bound
* to a group is guaranteed to be invoked by one of the pooled threads in the
* group. This ensures that the completion handler is run by a thread with the
* expected <em>identity</em>.
*
* <p> Where an I/O operation completes immediately, and the initiating thread
* is one of the pooled threads in the group then the completion handler may
* be invoked directly by the initiating thread. To avoid stack overflow, an
* implementation may impose a limit as to the number of activations on the
* thread stack. Some I/O operations may prohibit invoking the completion
* handler directly by the initiating thread (see {@link
* AsynchronousServerSocketChannel#accept(Object,CompletionHandler) accept}).
*
* <a name="shutdown"><h4>Shutdown and Termination</h4></a>
*
* <p> The {@link #shutdown() shutdown} method is used to initiate an <em>orderly
* shutdown</em> of a group. An orderly shutdown marks the group as shutdown;
* further attempts to construct a channel that binds to the group will throw
* {@link ShutdownChannelGroupException}. Whether or not a group is shutdown can
* be tested using the {@link #isShutdown() isShutdown} method. Once shutdown,
* the group <em>terminates</em> when all asynchronous channels that are bound to
* the group are closed, all actively executing completion handlers have run to
* completion, and resources used by the group are released. No attempt is made
* to stop or interrupt threads that are executing completion handlers. The
* {@link #isTerminated() isTerminated} method is used to test if the group has
* terminated, and the {@link #awaitTermination awaitTermination} method can be
* used to block until the group has terminated.
*
* <p> The {@link #shutdownNow() shutdownNow} method can be used to initiate a
* <em>forceful shutdown</em> of the group. In addition to the actions performed
* by an orderly shutdown, the {@code shutdownNow} method closes all open channels
* in the group as if by invoking the {@link AsynchronousChannel#close close}
* method.
*
* @since 1.7
*
* @see AsynchronousSocketChannel#open(AsynchronousChannelGroup)
* @see AsynchronousServerSocketChannel#open(AsynchronousChannelGroup)
*/
public abstract class AsynchronousChannelGroup {
private final AsynchronousChannelProvider provider;
/**
* Initialize a new instance of this class.
*
* @param provider
* The asynchronous channel provider for this group
*/
protected AsynchronousChannelGroup(AsynchronousChannelProvider provider) {
this.provider = provider;
}
/**
* Returns the provider that created this channel group.
*
* @return The provider that created this channel group
*/
public final AsynchronousChannelProvider provider() {
return provider;
}
/**
* Creates an asynchronous channel group with a fixed thread pool.
*
* <p> The resulting asynchronous channel group reuses a fixed number of
* threads. At any point, at most {@code nThreads} threads will be active
* processing tasks that are submitted to handle I/O events and dispatch
* completion results for operations initiated on asynchronous channels in
* the group.
*
* <p> The group is created by invoking the {@link
* AsynchronousChannelProvider#openAsynchronousChannelGroup(int,ThreadFactory)
* openAsynchronousChannelGroup(int,ThreadFactory)} method of the system-wide
* default {@link AsynchronousChannelProvider} object.
*
* @param nThreads
* The number of threads in the pool
* @param threadFactory
* The factory to use when creating new threads
*
* @return A new asynchronous channel group
*
* @throws IllegalArgumentException
* If {@code nThreads <= 0}
* @throws IOException
* If an I/O error occurs
*/
public static AsynchronousChannelGroup withFixedThreadPool(int nThreads,
ThreadFactory threadFactory)
throws IOException
{
return AsynchronousChannelProvider.provider()
.openAsynchronousChannelGroup(nThreads, threadFactory);
}
/**
* Creates an asynchronous channel group with a given thread pool that
* creates new threads as needed.
*
* <p> The {@code executor} parameter is an {@code ExecutorService} that
* creates new threads as needed to execute tasks that are submitted to
* handle I/O events and dispatch completion results for operations initiated
* on asynchronous channels in the group. It may reuse previously constructed
* threads when they are available.
*
* <p> The {@code initialSize} parameter may be used by the implementation
* as a <em>hint</em> as to the initial number of tasks it may submit. For
* example, it may be used to indictae the initial number of threads that
* wait on I/O events.
*
* <p> The executor is intended to be used exclusively by the resulting
* asynchronous channel group. Termination of the group results in the
* orderly {@link ExecutorService#shutdown shutdown} of the executor
* service. Shutting down the executor service by other means results in
* unspecified behavior.
*
* <p> The group is created by invoking the {@link
* AsynchronousChannelProvider#openAsynchronousChannelGroup(ExecutorService,int)
* openAsynchronousChannelGroup(ExecutorService,int)} method of the system-wide
* default {@link AsynchronousChannelProvider} object.
*
* @param executor
* The thread pool for the resulting group
* @param initialSize
* A value {@code >=0} or a negative value for implementation
* specific default
*
* @return A new asynchronous channel group
*
* @throws IOException
* If an I/O error occurs
*
* @see java.util.concurrent.Executors#newCachedThreadPool
*/
public static AsynchronousChannelGroup withCachedThreadPool(ExecutorService executor,
int initialSize)
throws IOException
{
return AsynchronousChannelProvider.provider()
.openAsynchronousChannelGroup(executor, initialSize);
}
/**
* Creates an asynchronous channel group with a given thread pool.
*
* <p> The {@code executor} parameter is an {@code ExecutorService} that
* executes tasks submitted to dispatch completion results for operations
* initiated on asynchronous channels in the group.
*
* <p> Care should be taken when configuring the executor service. It
* should support <em>direct handoff</em> or <em>unbounded queuing</em> of
* submitted tasks, and the thread that invokes the {@link
* ExecutorService#execute execute} method should never invoke the task
* directly. An implementation may mandate additional constraints.
*
* <p> The executor is intended to be used exclusively by the resulting
* asynchronous channel group. Termination of the group results in the
* orderly {@link ExecutorService#shutdown shutdown} of the executor
* service. Shutting down the executor service by other means results in
* unspecified behavior.
*
* <p> The group is created by invoking the {@link
* AsynchronousChannelProvider#openAsynchronousChannelGroup(ExecutorService,int)
* openAsynchronousChannelGroup(ExecutorService,int)} method of the system-wide
* default {@link AsynchronousChannelProvider} object with an {@code
* initialSize} of {@code 0}.
*
* @param executor
* The thread pool for the resulting group
*
* @return A new asynchronous channel group
*
* @throws IOException
* If an I/O error occurs
*/
public static AsynchronousChannelGroup withThreadPool(ExecutorService executor)
throws IOException
{
return AsynchronousChannelProvider.provider()
.openAsynchronousChannelGroup(executor, 0);
}
/**
* Tells whether or not this asynchronous channel group is shutdown.
*
* @return {@code true} if this asynchronous channel group is shutdown or
* has been marked for shutdown.
*/
public abstract boolean isShutdown();
/**
* Tells whether or not this group has terminated.
*
* <p> Where this method returns {@code true}, then the associated thread
* pool has also {@link ExecutorService#isTerminated terminated}.
*
* @return {@code true} if this group has terminated
*/
public abstract boolean isTerminated();
/**
* Initiates an orderly shutdown of the group.
*
* <p> This method marks the group as shutdown. Further attempts to construct
* channel that binds to this group will throw {@link ShutdownChannelGroupException}.
* The group terminates when all asynchronous channels in the group are
* closed, all actively executing completion handlers have run to completion,
* and all resources have been released. This method has no effect if the
* group is already shutdown.
*/
public abstract void shutdown();
/**
* Shuts down the group and closes all open channels in the group.
*
* <p> In addition to the actions performed by the {@link #shutdown() shutdown}
* method, this method invokes the {@link AsynchronousChannel#close close}
* method on all open channels in the group. This method does not attempt to
* stop or interrupt threads that are executing completion handlers. The
* group terminates when all actively executing completion handlers have run
* to completion and all resources have been released. This method may be
* invoked at any time. If some other thread has already invoked it, then
* another invocation will block until the first invocation is complete,
* after which it will return without effect.
*
* @throws IOException
* If an I/O error occurs
*/
public abstract void shutdownNow() throws IOException;
/**
* Awaits termination of the group.
* <p> This method blocks until the group has terminated, or the timeout
* occurs, or the current thread is interrupted, whichever happens first.
*
* @param timeout
* The maximum time to wait, or zero or less to not wait
* @param unit
* The time unit of the timeout argument
*
* @return {@code true} if the group has terminated; {@code false} if the
* timeout elapsed before termination
*
* @throws InterruptedException
* If interrupted while waiting
*/
public abstract boolean awaitTermination(long timeout, TimeUnit unit)
throws InterruptedException;
}
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package java.nio.channels;
import java.nio.channels.spi.*;
import java.net.SocketOption;
import java.net.SocketAddress;
import java.util.concurrent.Future;
import java.io.IOException;
/**
* An asynchronous channel for stream-oriented listening sockets.
*
* <p> An asynchronous server-socket channel is created by invoking the
* {@link #open open} method of this class.
* A newly-created asynchronous server-socket channel is open but not yet bound.
* It can be bound to a local address and configured to listen for connections
* by invoking the {@link #bind(SocketAddress,int) bind} method. Once bound,
* the {@link #accept(Object,CompletionHandler) accept} method
* is used to initiate the accepting of connections to the channel's socket.
* An attempt to invoke the <tt>accept</tt> method on an unbound channel will
* cause a {@link NotYetBoundException} to be thrown.
*
* <p> Channels of this type are safe for use by multiple concurrent threads
* though at most one accept operation can be outstanding at any time.
* If a thread initiates an accept operation before a previous accept operation
* has completed then an {@link AcceptPendingException} will be thrown.
*
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Channels of this type support the following options:
* <blockquote>
* <table border>
* <tr>
* <th>Option Name</th>
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
* <td> The size of the socket receive buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> Re-use address </td>
* </tr>
* </table>
* </blockquote>
* Additional (implementation specific) options may also be supported.
*
* <p> <b>Usage Example:</b>
* <pre>
* final AsynchronousServerSocketChannel listener =
* AsynchronousServerSocketChannel.open().bind(new InetSocketAddress(5000));
*
* listener.accept(null, new CompletionHandler&lt;AsynchronousSocketChannel,Void&gt;() {
* public void completed(AsynchronousSocketChannel ch, Void att) {
* // accept the next connection
* listener.accept(null, this);
*
* // handle this connection
* handle(ch);
* }
* public void failed(Throwable exc, Void att) {
* ...
* }
* public void cancelled(Void att) {
* ...
* }
* });
* </pre>
*
* @since 1.7
*/
public abstract class AsynchronousServerSocketChannel
implements AsynchronousChannel, NetworkChannel
{
private final AsynchronousChannelProvider provider;
/**
* Initializes a new instance of this class.
*/
protected AsynchronousServerSocketChannel(AsynchronousChannelProvider provider) {
this.provider = provider;
}
/**
* Returns the provider that created this channel.
*/
public final AsynchronousChannelProvider provider() {
return provider;
}
/**
* Opens an asynchronous server-socket channel.
*
* <p> The new channel is created by invoking the {@link
* java.nio.channels.spi.AsynchronousChannelProvider#openAsynchronousServerSocketChannel
* openAsynchronousServerSocketChannel} method on the {@link
* java.nio.channels.spi.AsynchronousChannelProvider} object that created
* the given group. If the group parameter is <tt>null</tt> then the
* resulting channel is created by the system-wide default provider, and
* bound to the <em>default group</em>.
*
* @param group
* The group to which the newly constructed channel should be bound,
* or <tt>null</tt> for the default group
*
* @return A new asynchronous server socket channel
*
* @throws ShutdownChannelGroupException
* If the channel group is shutdown
* @throws IOException
* If an I/O error occurs
*/
public static AsynchronousServerSocketChannel open(AsynchronousChannelGroup group)
throws IOException
{
AsynchronousChannelProvider provider = (group == null) ?
AsynchronousChannelProvider.provider() : group.provider();
return provider.openAsynchronousServerSocketChannel(group);
}
/**
* Opens an asynchronous server-socket channel.
*
* <p> This method returns an asynchronous server socket channel that is
* bound to the <em>default group</em>. This method is equivalent to evaluating
* the expression:
* <blockquote><pre>
* open((AsynchronousChannelGroup)null);
* </pre></blockquote>
*
* @return A new asynchronous server socket channel
*
* @throws IOException
* If an I/O error occurs
*/
public static AsynchronousServerSocketChannel open()
throws IOException
{
return open(null);
}
/**
* Binds the channel's socket to a local address and configures the socket to
* listen for connections.
*
* <p> An invocation of this method is equivalent to the following:
* <blockquote><pre>
* bind(local, 0);
* </pre></blockquote>
*
* @param local
* The local address to bind the socket, or <tt>null</tt> to bind
* to an automatically assigned socket address
*
* @return This channel
*
* @throws AlreadyBoundException {@inheritDoc}
* @throws UnsupportedAddressTypeException {@inheritDoc}
* @throws SecurityException {@inheritDoc}
* @throws ClosedChannelException {@inheritDoc}
* @throws IOException {@inheritDoc}
*/
public final AsynchronousServerSocketChannel bind(SocketAddress local)
throws IOException
{
return bind(local, 0);
}
/**
* Binds the channel's socket to a local address and configures the socket to
* listen for connections.
*
* <p> This method is used to establish an association between the socket and
* a local address. Once an association is established then the socket remains
* bound until the associated channel is closed.
*
* <p> The {@code backlog} parameter is the maximum number of pending
* connections on the socket. Its exact semantics are implementation specific.
* In particular, an implementation may impose a maximum length or may choose
* to ignore the parameter altogther. If the {@code backlog} parameter has
* the value {@code 0}, or a negative value, then an implementation specific
* default is used.
*
* @param local
* The local address to bind the socket, or {@code null} to bind
* to an automatically assigned socket address
* @param backlog
* The maximum number of pending connections
*
* @return This channel
*
* @throws AlreadyBoundException
* If the socket is already bound
* @throws UnsupportedAddressTypeException
* If the type of the given address is not supported
* @throws SecurityException
* If a security manager has been installed and its {@link
* SecurityManager#checkListen checkListen} method denies the operation
* @throws ClosedChannelException
* If the channel is closed
* @throws IOException
* If some other I/O error occurs
*/
public abstract AsynchronousServerSocketChannel bind(SocketAddress local, int backlog)
throws IOException;
/**
* @throws IllegalArgumentException {@inheritDoc}
* @throws ClosedChannelException {@inheritDoc}
* @throws IOException {@inheritDoc}
*/
public abstract <T> AsynchronousServerSocketChannel setOption(SocketOption<T> name, T value)
throws IOException;
/**
* Accepts a connection.
*
* <p> This method initiates accepting a connection made to this channel's
* socket, returning a {@link Future} representing the pending result
* of the operation. The {@code Future}'s {@link Future#get() get}
* method will return the {@link AsynchronousSocketChannel} for the new
* connection on successful completion.
*
* <p> When a new connection is accepted then the resulting {@code
* AsynchronousSocketChannel} will be bound to the same {@link
* AsynchronousChannelGroup} as this channel. If the group is {@link
* AsynchronousChannelGroup#isShutdown shutdown} and a connection is accepted,
* then the connection is closed, and the operation completes with an {@code
* IOException} and cause {@link ShutdownChannelGroupException}.
*
* <p> To allow for concurrent handling of new connections, the completion
* handler is not invoked directly by the initiating thread when a new
* connection is accepted immediately (see <a
* href="AsynchronousChannelGroup.html#threading">Threading<a>).
*
* <p> If a security manager has been installed then it verifies that the
* address and port number of the connection's remote endpoint are permitted
* by the security manager's {@link SecurityManager#checkAccept checkAccept}
* method. The permission check is performed with privileges that are restricted
* by the calling context of this method. If the permission check fails then
* the connection is closed and the operation completes with a {@link
* SecurityException}.
*
* @param attachment
* The object to attach to the I/O operation; can be {@code null}
* @param handler
* The handler for consuming the result; can be {@code null}
*
* @return an <tt>Future</tt> object representing the pending result
*
* @throws AcceptPendingException
* If an accept operation is already in progress on this channel
* @throws NotYetBoundException
* If this channel's socket has not yet been bound
* @throws ShutdownChannelGroupException
* If a handler is specified, and the channel group is shutdown
*/
public abstract <A> Future<AsynchronousSocketChannel>
accept(A attachment, CompletionHandler<AsynchronousSocketChannel,? super A> handler);
/**
* Accepts a connection.
*
* <p> This method is equivalent to invoking {@link
* #accept(Object,CompletionHandler)} with the {@code attachment}
* and {@code handler} parameters set to {@code null}.
*
* @return an <tt>Future</tt> object representing the pending result
*
* @throws AcceptPendingException
* If an accept operation is already in progress on this channel
* @throws NotYetBoundException
* If this channel's socket has not yet been bound
*/
public final Future<AsynchronousSocketChannel> accept() {
return accept(null, null);
}
}
/* /*
* Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -33,15 +33,12 @@ import java.io.Reader; ...@@ -33,15 +33,12 @@ import java.io.Reader;
import java.io.Writer; import java.io.Writer;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
import java.nio.charset.UnsupportedCharsetException; import java.nio.charset.UnsupportedCharsetException;
import java.nio.channels.spi.AbstractInterruptibleChannel; import java.nio.channels.spi.AbstractInterruptibleChannel;
import java.util.concurrent.ExecutionException;
import sun.nio.ch.ChannelInputStream; import sun.nio.ch.ChannelInputStream;
import sun.nio.cs.StreamDecoder; import sun.nio.cs.StreamDecoder;
import sun.nio.cs.StreamEncoder; import sun.nio.cs.StreamEncoder;
...@@ -184,6 +181,155 @@ public final class Channels { ...@@ -184,6 +181,155 @@ public final class Channels {
}; };
} }
/**
* {@note new}
* Constructs a stream that reads bytes from the given channel.
*
* <p> The stream will not be buffered, and it will not support the {@link
* InputStream#mark mark} or {@link InputStream#reset reset} methods. The
* stream will be safe for access by multiple concurrent threads. Closing
* the stream will in turn cause the channel to be closed. </p>
*
* @param ch
* The channel from which bytes will be read
*
* @return A new input stream
*
* @since 1.7
*/
public static InputStream newInputStream(final AsynchronousByteChannel ch) {
checkNotNull(ch, "ch");
return new InputStream() {
private ByteBuffer bb = null;
private byte[] bs = null; // Invoker's previous array
private byte[] b1 = null;
@Override
public synchronized int read() throws IOException {
if (b1 == null)
b1 = new byte[1];
int n = this.read(b1);
if (n == 1)
return b1[0] & 0xff;
return -1;
}
@Override
public synchronized int read(byte[] bs, int off, int len)
throws IOException
{
if ((off < 0) || (off > bs.length) || (len < 0) ||
((off + len) > bs.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0)
return 0;
ByteBuffer bb = ((this.bs == bs)
? this.bb
: ByteBuffer.wrap(bs));
bb.position(off);
bb.limit(Math.min(off + len, bb.capacity()));
this.bb = bb;
this.bs = bs;
boolean interrupted = false;
try {
for (;;) {
try {
return ch.read(bb).get();
} catch (ExecutionException ee) {
throw new IOException(ee.getCause());
} catch (InterruptedException ie) {
interrupted = true;
}
}
} finally {
if (interrupted)
Thread.currentThread().interrupt();
}
}
@Override
public void close() throws IOException {
ch.close();
}
};
}
/**
* {@note new}
* Constructs a stream that writes bytes to the given channel.
*
* <p> The stream will not be buffered. The stream will be safe for access
* by multiple concurrent threads. Closing the stream will in turn cause
* the channel to be closed. </p>
*
* @param ch
* The channel to which bytes will be written
*
* @return A new output stream
*
* @since 1.7
*/
public static OutputStream newOutputStream(final AsynchronousByteChannel ch) {
checkNotNull(ch, "ch");
return new OutputStream() {
private ByteBuffer bb = null;
private byte[] bs = null; // Invoker's previous array
private byte[] b1 = null;
@Override
public synchronized void write(int b) throws IOException {
if (b1 == null)
b1 = new byte[1];
b1[0] = (byte)b;
this.write(b1);
}
@Override
public synchronized void write(byte[] bs, int off, int len)
throws IOException
{
if ((off < 0) || (off > bs.length) || (len < 0) ||
((off + len) > bs.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
ByteBuffer bb = ((this.bs == bs)
? this.bb
: ByteBuffer.wrap(bs));
bb.limit(Math.min(off + len, bb.capacity()));
bb.position(off);
this.bb = bb;
this.bs = bs;
boolean interrupted = false;
try {
while (bb.remaining() > 0) {
try {
ch.write(bb).get();
} catch (ExecutionException ee) {
throw new IOException(ee.getCause());
} catch (InterruptedException ie) {
interrupted = true;
}
}
} finally {
if (interrupted)
Thread.currentThread().interrupt();
}
}
@Override
public void close() throws IOException {
ch.close();
}
};
}
// -- Channels from streams -- // -- Channels from streams --
...@@ -468,5 +614,4 @@ public final class Channels { ...@@ -468,5 +614,4 @@ public final class Channels {
checkNotNull(csName, "csName"); checkNotNull(csName, "csName");
return newWriter(ch, Charset.forName(csName).newEncoder(), -1); return newWriter(ch, Charset.forName(csName).newEncoder(), -1);
} }
} }
/*
* Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package java.nio.channels;
/**
* A handler for consuming the result of an asynchronous I/O operation.
*
* <p> The asynchronous channels defined in this package allow a completion
* handler to be specified to consume the result of an asynchronous operation.
* The {@link #completed completed} method is invoked when the I/O operation
* completes successfully. The {@link #failed failed} method is invoked if the
* I/O operations fails. The {@link #cancelled cancelled} method is invoked when
* the I/O operation is cancelled by invoking the {@link
* java.util.concurrent.Future#cancel cancel} method. The implementations of
* these methods should complete in a timely manner so as to avoid keeping the
* invoking thread from dispatching to other completion handlers.
*
* @param <V> The result type of the I/O operation
* @param <A> The type of the object attached to the I/O operation
*
* @since 1.7
*/
public interface CompletionHandler<V,A> {
/**
* Invoked when an operation has completed.
*
* @param result
* The result of the I/O operation.
* @param attachment
* The object attached to the I/O operation when it was initiated.
*/
void completed(V result, A attachment);
/**
* Invoked when an operation fails.
*
* @param exc
* The exception to indicate why the I/O operation failed
* @param attachment
* The object attached to the I/O operation when it was initiated.
*/
void failed(Throwable exc, A attachment);
/**
* Invoked when an operation is cancelled by invoking the {@link
* java.util.concurrent.Future#cancel cancel} method.
*
* @param attachment
* The object attached to the I/O operation when it was initiated.
*/
void cancelled(A attachment);
}
/* /*
* Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -31,7 +31,8 @@ import java.net.DatagramSocket; ...@@ -31,7 +31,8 @@ import java.net.DatagramSocket;
import java.net.SocketOption; import java.net.SocketOption;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.spi.*; import java.nio.channels.spi.AbstractSelectableChannel;
import java.nio.channels.spi.SelectorProvider;
/** /**
* A selectable channel for datagram-oriented sockets. * A selectable channel for datagram-oriented sockets.
...@@ -53,7 +54,8 @@ import java.nio.channels.spi.*; ...@@ -53,7 +54,8 @@ import java.nio.channels.spi.*;
* be determined by invoking its {@link #isConnected isConnected} method. * be determined by invoking its {@link #isConnected isConnected} method.
* *
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object) * <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Datagram channels support the following options: * setOption} method. A datagram channel to an Internet Protocol socket supports
* the following options:
* <blockquote> * <blockquote>
* <table border> * <table border>
* <tr> * <tr>
...@@ -211,6 +213,7 @@ public abstract class DatagramChannel ...@@ -211,6 +213,7 @@ public abstract class DatagramChannel
throws IOException; throws IOException;
/** /**
* @throws UnsupportedOperationException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc} * @throws IllegalArgumentException {@inheritDoc}
* @throws ClosedChannelException {@inheritDoc} * @throws ClosedChannelException {@inheritDoc}
* @throws IOException {@inheritDoc} * @throws IOException {@inheritDoc}
...@@ -220,7 +223,6 @@ public abstract class DatagramChannel ...@@ -220,7 +223,6 @@ public abstract class DatagramChannel
public abstract <T> DatagramChannel setOption(SocketOption<T> name, T value) public abstract <T> DatagramChannel setOption(SocketOption<T> name, T value)
throws IOException; throws IOException;
/** /**
* Retrieves a datagram socket associated with this channel. * Retrieves a datagram socket associated with this channel.
* *
...@@ -313,15 +315,17 @@ public abstract class DatagramChannel ...@@ -313,15 +315,17 @@ public abstract class DatagramChannel
/** /**
* Returns the remote address to which this channel's socket is connected. * Returns the remote address to which this channel's socket is connected.
* *
* @return The remote address; {@code null} if the channel is not {@link * @return The remote address; {@code null} if the channel's socket is not
* #isOpen open} or the channel's socket is not connected * connected
* *
* @throws ClosedChannelException
* If the channel is closed
* @throws IOException * @throws IOException
* If an I/O error occurs * If an I/O error occurs
* *
* @since 1.7 * @since 1.7
*/ */
public abstract SocketAddress getConnectedAddress() throws IOException; public abstract SocketAddress getRemoteAddress() throws IOException;
/** /**
* Receives a datagram via this channel. * Receives a datagram via this channel.
......
/* /*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -27,14 +27,16 @@ package java.nio.channels; ...@@ -27,14 +27,16 @@ package java.nio.channels;
import java.io.IOException; import java.io.IOException;
/** /**
* A token representing a lock on a region of a file. * A token representing a lock on a region of a file.
* *
* <p> A file-lock object is created each time a lock is acquired on a file via * <p> A file-lock object is created each time a lock is acquired on a file via
* one of the {@link FileChannel#lock(long,long,boolean) lock} or {@link * one of the {@link FileChannel#lock(long,long,boolean) lock} or {@link
* FileChannel#tryLock(long,long,boolean) tryLock} methods of the {@link * FileChannel#tryLock(long,long,boolean) tryLock} methods of the
* FileChannel} class. * {@link FileChannel} class, or the {@link
* AsynchronousFileChannel#lock(long,long,boolean,Object,CompletionHandler) lock}
* or {@link AsynchronousFileChannel#tryLock(long,long,boolean) tryLock}
* methods of the {@link AsynchronousFileChannel} class.
* *
* <p> A file-lock object is initially valid. It remains valid until the lock * <p> A file-lock object is initially valid. It remains valid until the lock
* is released by invoking the {@link #release release} method, by closing the * is released by invoking the {@link #release release} method, by closing the
...@@ -70,8 +72,7 @@ import java.io.IOException; ...@@ -70,8 +72,7 @@ import java.io.IOException;
* <p> File-lock objects are safe for use by multiple concurrent threads. * <p> File-lock objects are safe for use by multiple concurrent threads.
* *
* *
* <a name="pdep"> * <a name="pdep"><h4> Platform dependencies </h4></a>
* <h4> Platform dependencies </h4>
* *
* <p> This file-locking API is intended to map directly to the native locking * <p> This file-locking API is intended to map directly to the native locking
* facility of the underlying operating system. Thus the locks held on a file * facility of the underlying operating system. Thus the locks held on a file
...@@ -93,7 +94,7 @@ import java.io.IOException; ...@@ -93,7 +94,7 @@ import java.io.IOException;
* *
* <p> On some systems, acquiring a mandatory lock on a region of a file * <p> On some systems, acquiring a mandatory lock on a region of a file
* prevents that region from being {@link java.nio.channels.FileChannel#map * prevents that region from being {@link java.nio.channels.FileChannel#map
* </code>mapped into memory<code>}, and vice versa. Programs that combine * <i>mapped into memory</i>}, and vice versa. Programs that combine
* locking and mapping should be prepared for this combination to fail. * locking and mapping should be prepared for this combination to fail.
* *
* <p> On some systems, closing a channel releases all locks held by the Java * <p> On some systems, closing a channel releases all locks held by the Java
...@@ -113,11 +114,12 @@ import java.io.IOException; ...@@ -113,11 +114,12 @@ import java.io.IOException;
* @author Mark Reinhold * @author Mark Reinhold
* @author JSR-51 Expert Group * @author JSR-51 Expert Group
* @since 1.4 * @since 1.4
* @updated 1.7
*/ */
public abstract class FileLock { public abstract class FileLock {
private final FileChannel channel; private final Channel channel;
private final long position; private final long position;
private final long size; private final long size;
private final boolean shared; private final boolean shared;
...@@ -159,11 +161,66 @@ public abstract class FileLock { ...@@ -159,11 +161,66 @@ public abstract class FileLock {
} }
/** /**
* Returns the file channel upon whose file this lock is held. </p> * {@note new} Initializes a new instance of this class.
*
* @param channel
* The channel upon whose file this lock is held
*
* @param position
* The position within the file at which the locked region starts;
* must be non-negative
*
* @param size
* The size of the locked region; must be non-negative, and the sum
* <tt>position</tt>&nbsp;+&nbsp;<tt>size</tt> must be non-negative
*
* @param shared
* <tt>true</tt> if this lock is shared,
* <tt>false</tt> if it is exclusive
*
* @throws IllegalArgumentException
* If the preconditions on the parameters do not hold
*
* @since 1.7
*/
protected FileLock(AsynchronousFileChannel channel,
long position, long size, boolean shared)
{
if (position < 0)
throw new IllegalArgumentException("Negative position");
if (size < 0)
throw new IllegalArgumentException("Negative size");
if (position + size < 0)
throw new IllegalArgumentException("Negative position + size");
this.channel = channel;
this.position = position;
this.size = size;
this.shared = shared;
}
/**
* {@note revised}
* Returns the file channel upon whose file this lock was acquired.
* *
* @return The file channel * <p> This method has been superseded by the {@link #acquiredBy acquiredBy}
* method.
*
* @return The file channel, or {@code null} if the file lock was not
* acquired by a file channel.
*/ */
public final FileChannel channel() { public final FileChannel channel() {
return (channel instanceof FileChannel) ? (FileChannel)channel : null;
}
/**
* {@note new}
* Returns the channel upon whose file this lock was acquired.
*
* @return The channel upon whose file this lock was acquired.
*
* @since 1.7
*/
public Channel acquiredBy() {
return channel; return channel;
} }
......
/* /*
* Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -122,6 +122,22 @@ import java.net.StandardSocketOption; // javadoc ...@@ -122,6 +122,22 @@ import java.net.StandardSocketOption; // javadoc
public interface MulticastChannel public interface MulticastChannel
extends NetworkChannel extends NetworkChannel
{ {
/**
* Closes this channel.
*
* <p> If the channel is a member of a multicast group then the membership
* is {@link MembershipKey#drop dropped}. Upon return, the {@link
* MembershipKey membership-key} will be {@link MembershipKey#isValid
* invalid}.
*
* <p> This method otherwise behaves exactly as specified by the {@link
* Channel} interface.
*
* @throws IOException
* If an I/O error occurs
*/
@Override void close() throws IOException;
/** /**
* Joins a multicast group to begin receiving all datagrams sent to the group, * Joins a multicast group to begin receiving all datagrams sent to the group,
* returning a membership key. * returning a membership key.
...@@ -130,7 +146,7 @@ public interface MulticastChannel ...@@ -130,7 +146,7 @@ public interface MulticastChannel
* interface to receive all datagrams then the membership key, representing * interface to receive all datagrams then the membership key, representing
* that membership, is returned. Otherwise this channel joins the group and * that membership, is returned. Otherwise this channel joins the group and
* the resulting new membership key is returned. The resulting membership key * the resulting new membership key is returned. The resulting membership key
* is not {@link MembershipKey#getSourceAddress source-specific}. * is not {@link MembershipKey#sourceAddress source-specific}.
* *
* <p> A multicast channel may join several multicast groups, including * <p> A multicast channel may join several multicast groups, including
* the same group on more than one interface. An implementation may impose a * the same group on more than one interface. An implementation may impose a
...@@ -150,6 +166,8 @@ public interface MulticastChannel ...@@ -150,6 +166,8 @@ public interface MulticastChannel
* @throws IllegalStateException * @throws IllegalStateException
* If the channel already has source-specific membership of the * If the channel already has source-specific membership of the
* group on the interface * group on the interface
* @throws UnsupportedOperationException
* If the channel's socket is not an Internet Protocol socket
* @throws ClosedChannelException * @throws ClosedChannelException
* If this channel is closed * If this channel is closed
* @throws IOException * @throws IOException
...@@ -170,7 +188,7 @@ public interface MulticastChannel ...@@ -170,7 +188,7 @@ public interface MulticastChannel
* interface to receive datagrams from the given source address then the * interface to receive datagrams from the given source address then the
* membership key, representing that membership, is returned. Otherwise this * membership key, representing that membership, is returned. Otherwise this
* channel joins the group and the resulting new membership key is returned. * channel joins the group and the resulting new membership key is returned.
* The resulting membership key is {@link MembershipKey#getSourceAddress * The resulting membership key is {@link MembershipKey#sourceAddress
* source-specific}. * source-specific}.
* *
* <p> Membership is <em>cumulative</em> and this method may be invoked * <p> Membership is <em>cumulative</em> and this method may be invoked
...@@ -196,7 +214,8 @@ public interface MulticastChannel ...@@ -196,7 +214,8 @@ public interface MulticastChannel
* If the channel is currently a member of the group on the given * If the channel is currently a member of the group on the given
* interface to receive all datagrams * interface to receive all datagrams
* @throws UnsupportedOperationException * @throws UnsupportedOperationException
* If the underlying operation system does not support source filtering * If the channel's socket is not an Internet Protocol socket or
* source filtering is not supported
* @throws ClosedChannelException * @throws ClosedChannelException
* If this channel is closed * If this channel is closed
* @throws IOException * @throws IOException
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册