Source Code Cross Referenced for ServerSocketChannel.java in  » Apache-Harmony-Java-SE » java-package » java » nio » channels » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.nio.channels 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:
018:        package java.nio.channels;
019:
020:        import java.io.IOException;
021:        import java.net.ServerSocket;
022:        import java.nio.channels.spi.AbstractSelectableChannel;
023:        import java.nio.channels.spi.SelectorProvider;
024:
025:        /**
026:         * A ServerSocketChannel is a partly abstracted stream-oriented listening socket
027:         * which is selectable. Binding and manipulation of socket options can only be
028:         * done through the associated <code>ServerSocket</code> object, returned by
029:         * calling socket method. ServerSocketChannels can not be constructed for a
030:         * pre-existing server socket, nor can it be assigned a SocketImpl.
031:         * <p>
032:         * A Server-Socket channel is open but not bound when created by
033:         * <code>open</code> method. (Calling <code>accept</code> before bound will
034:         * cause a <code>NotYetBoundException</code>). It can be bound by calling the
035:         * bind method of a related <code>ServerSocket</code> instance.
036:         * </p>
037:         */
038:        public abstract class ServerSocketChannel extends
039:                AbstractSelectableChannel {
040:
041:            /**
042:             * Construct a new instance for ServerSocketChannel
043:             * 
044:             * @param selectorProvider
045:             *            An instance of SelectorProvider
046:             */
047:            protected ServerSocketChannel(SelectorProvider selectorProvider) {
048:                super (selectorProvider);
049:            }
050:
051:            /**
052:             * Create an open and unbound server-socket channel.
053:             * <p>
054:             * This channel is got by calling <code>openServerSocketChannel</code>
055:             * method of the default <code>SelectorProvider </code> instance.
056:             * </p>
057:             * 
058:             * @return The new created channel which is open but unbound.
059:             * @throws IOException
060:             *             If some IO problem occurs.
061:             */
062:            public static ServerSocketChannel open() throws IOException {
063:                return SelectorProvider.provider().openServerSocketChannel();
064:            }
065:
066:            /**
067:             * Get the valid operations of this channel. Server-socket channels support
068:             * accepting operation.Currently the only supported operation is OP_ACCEPT.
069:             * It always returns <code>SelectionKey.OP_ACCEPT</code>.
070:             * 
071:             * @see java.nio.channels.SelectableChannel#validOps()
072:             * @return Valid operations in bit-set.
073:             */
074:            @Override
075:            public final int validOps() {
076:                return SelectionKey.OP_ACCEPT;
077:            }
078:
079:            /**
080:             * Return the related server-socket of this channel. All public methods
081:             * declared in returned object should be declared in
082:             * <code>ServerSocket</code>.
083:             * 
084:             * @return The related ServerSocket instance.
085:             */
086:            public abstract ServerSocket socket();
087:
088:            /**
089:             * Accepts a connection to this socket.
090:             * <p>
091:             * It returns null when the channel is non-blocking and no connections
092:             * available, otherwise it blocks indefinitely until a new connection is
093:             * available or an I/O error occurs. The returned channel will be in
094:             * blocking mode any way.
095:             * </p>
096:             * 
097:             * <p>
098:             * This method just execute the same security checks as the accept method of
099:             * the <code>ServerSocket</code> class.
100:             * </p>
101:             * 
102:             * @return The accepted SocketChannel instance, or null as the channel is
103:             *         non-blocking and no connections available.
104:             * @throws ClosedChannelException
105:             *             If the channel is already closed.
106:             * @throws AsynchronousCloseException
107:             *             If the channel is closed by another thread while this method
108:             *             is in operation.
109:             * @throws ClosedByInterruptException
110:             *             If another thread interrupts the calling thread while the
111:             *             operation is in progress. The calling thread will have the
112:             *             interrupt state set, and the channel will be closed.
113:             * @throws NotYetBoundException
114:             *             If the socket has not yet been bound.
115:             * @throws SecurityException
116:             *             If there is a security manager, and the new connection is not
117:             *             permitted to access.
118:             * @throws IOException
119:             *             Some other IO error occurred.
120:             * 
121:             */
122:            public abstract SocketChannel accept() throws IOException;
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.