Source Code Cross Referenced for SelectableChannel.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:        /* Licensed to the Apache Software Foundation (ASF) under one or more
002:         * contributor license agreements.  See the NOTICE file distributed with
003:         * this work for additional information regarding copyright ownership.
004:         * The ASF licenses this file to You under the Apache License, Version 2.0
005:         * (the "License"); you may not use this file except in compliance with
006:         * the License.  You may obtain a copy of the License at
007:         * 
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package java.nio.channels;
018:
019:        import java.io.IOException;
020:        import java.nio.channels.spi.AbstractInterruptibleChannel;
021:        import java.nio.channels.spi.SelectorProvider;
022:
023:        /**
024:         * A channel that can be detected by a selector. The channel can be registered
025:         * with some selectors, and when invoke select method of the selectors, the
026:         * channel can be checked if it is readable, writable, connectable or acceptable
027:         * according to its interesting operation.
028:         */
029:        public abstract class SelectableChannel extends
030:                AbstractInterruptibleChannel implements  Channel {
031:
032:            /**
033:             * Default constructor, can be overridden.
034:             */
035:            protected SelectableChannel() {
036:                super ();
037:            }
038:
039:            /**
040:             * Gets the blocking lock which synchronizes the configureBlocking and
041:             * register methods.
042:             * 
043:             * @return the blocking object as lock
044:             */
045:            public abstract Object blockingLock();
046:
047:            /**
048:             * Sets blocking mode of the channel.
049:             * 
050:             * @param block
051:             *            true as blocking, false as non-blocking
052:             * @return this channel
053:             * @throws ClosedChannelException
054:             *             If this channel has been closed
055:             * @throws IllegalBlockingModeException
056:             *             If the channel has been registered
057:             * @throws IOException
058:             *             if I/O error occurs
059:             */
060:            public abstract SelectableChannel configureBlocking(boolean block)
061:                    throws IOException;
062:
063:            /**
064:             * Returns if channel is in blocking mode.
065:             * 
066:             * @return true if channel is blocking
067:             */
068:            public abstract boolean isBlocking();
069:
070:            /**
071:             * Returns if channel is registered.
072:             * 
073:             * @return true if channel is registered
074:             */
075:            public abstract boolean isRegistered();
076:
077:            /**
078:             * Gets the selection key for the channel with the given selector.
079:             * 
080:             * @param sel
081:             *            the selector with which this channel may register
082:             * @return the selection key for the channel according to the given selector
083:             */
084:            public abstract SelectionKey keyFor(Selector sel);
085:
086:            /**
087:             * Gets the provider of the channel.
088:             * 
089:             * @return the provider of the channel
090:             */
091:            public abstract SelectorProvider provider();
092:
093:            /**
094:             * Registers with the given selector with a certain interesting operation.
095:             * 
096:             * @param selector
097:             *            the selector with which this channel shall be registered
098:             * @param operations
099:             *            the interesting operation
100:             * @return the selection key indicates the channel
101:             * @throws ClosedChannelException
102:             *             if the channel is closed
103:             * @throws IllegalBlockingModeException
104:             *             If the channel is in blocking mode
105:             * @throws IllegalSelectorException
106:             *             If this channel does not have the same provider as the given
107:             *             selector
108:             * @throws CancelledKeyException
109:             *             If this channel is registered but its key has been cancelled
110:             * @throws IllegalArgumentException
111:             *             If the operation given is unsupported by this channel
112:             */
113:            public final SelectionKey register(Selector selector, int operations)
114:                    throws ClosedChannelException {
115:                return register(selector, operations, null);
116:            }
117:
118:            /**
119:             * Registers with the given selector with a certain interesting operation
120:             * and an attached object.
121:             * 
122:             * @param sel
123:             *            the selector with which this channel shall be registered
124:             * @param ops
125:             *            the interesting operation
126:             * @param att
127:             *            The attached object, which can be null
128:             * @return the selection key indicates the channel
129:             * @throws ClosedChannelException
130:             *             if the channel is closed
131:             * @throws IllegalBlockingModeException
132:             *             If the channel is in blocking mode
133:             * @throws IllegalSelectorException
134:             *             If this channel does not have the same provider with the
135:             *             given selector
136:             * @throws CancelledKeyException
137:             *             If this channel is registered but its key has been cancelled
138:             * @throws IllegalArgumentException
139:             *             If the operation given is unsupported by this channel
140:             */
141:            public abstract SelectionKey register(Selector sel, int ops,
142:                    Object att) throws ClosedChannelException;
143:
144:            /**
145:             * Gets the possible interesting operation of the channel.
146:             * 
147:             * @return the possible interesting operation of the channel
148:             */
149:            public abstract int validOps();
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.