📄 iosession.html
字号:
<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the key of the attribute<DD><CODE>value</CODE> - the value of the attribute<DT><B>Returns:</B><DD>The old value of the attribute. <tt>null</tt> if it is new.</DL></DD></DL><HR><A NAME="setAttribute(java.lang.Object)"><!-- --></A><H3>setAttribute</H3><PRE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <B>setAttribute</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key)</PRE><DL><DD>Sets a user defined attribute without a value. This is useful when you just want to put a 'mark' attribute. Its value is set to <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Boolean.html?is-external=true#TRUE" title="class or interface in java.lang"><CODE>Boolean.TRUE</CODE></A>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the key of the attribute<DT><B>Returns:</B><DD>The old value of the attribute. <tt>null</tt> if it is new.</DL></DD></DL><HR><A NAME="setAttributeIfAbsent(java.lang.Object, java.lang.Object)"><!-- --></A><H3>setAttributeIfAbsent</H3><PRE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <B>setAttributeIfAbsent</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> value)</PRE><DL><DD>Sets a user defined attribute if the attribute with the specified key is not set yet. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key)) { return getAttribute(key); } else { return setAttribute(key, value); } </pre><P><DD><DL></DL></DD></DL><HR><A NAME="setAttributeIfAbsent(java.lang.Object)"><!-- --></A><H3>setAttributeIfAbsent</H3><PRE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <B>setAttributeIfAbsent</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key)</PRE><DL><DD>Sets a user defined attribute without a value if the attribute with the specified key is not set yet. This is useful when you just want to put a 'mark' attribute. Its value is set to <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Boolean.html?is-external=true#TRUE" title="class or interface in java.lang"><CODE>Boolean.TRUE</CODE></A>. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key)) { return getAttribute(key); // might not always be Boolean.TRUE. } else { return setAttribute(key); } </pre><P><DD><DL></DL></DD></DL><HR><A NAME="removeAttribute(java.lang.Object)"><!-- --></A><H3>removeAttribute</H3><PRE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <B>removeAttribute</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key)</PRE><DL><DD>Removes a user-defined attribute with the specified key.<P><DD><DL><DT><B>Returns:</B><DD>The old value of the attribute. <tt>null</tt> if not found.</DL></DD></DL><HR><A NAME="removeAttribute(java.lang.Object, java.lang.Object)"><!-- --></A><H3>removeAttribute</H3><PRE>boolean <B>removeAttribute</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> value)</PRE><DL><DD>Removes a user defined attribute with the specified key if the current attribute value is equal to the specified value. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key) && getAttribute(key).equals(value)) { removeAttribute(key); return true; } else { return false; } </pre><P><DD><DL></DL></DD></DL><HR><A NAME="replaceAttribute(java.lang.Object, java.lang.Object, java.lang.Object)"><!-- --></A><H3>replaceAttribute</H3><PRE>boolean <B>replaceAttribute</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> oldValue, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> newValue)</PRE><DL><DD>Replaces a user defined attribute with the specified key if the value of the attribute is equals to the specified old value. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key) && getAttribute(key).equals(oldValue)) { setAttribute(key, newValue); return true; } else { return false; } </pre><P><DD><DL></DL></DD></DL><HR><A NAME="containsAttribute(java.lang.Object)"><!-- --></A><H3>containsAttribute</H3><PRE>boolean <B>containsAttribute</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> key)</PRE><DL><DD>Returns <tt>true</tt> if this session contains the attribute with the specified <tt>key</tt>.<P><DD><DL></DL></DD></DL><HR><A NAME="getAttributeKeys()"><!-- --></A><H3>getAttributeKeys</H3><PRE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A><<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>> <B>getAttributeKeys</B>()</PRE><DL><DD>Returns the set of keys of all user-defined attributes.<P><DD><DL></DL></DD></DL><HR><A NAME="isConnected()"><!-- --></A><H3>isConnected</H3><PRE>boolean <B>isConnected</B>()</PRE><DL><DD>Returns <code>true</code> if this session is connected with remote peer.<P><DD><DL></DL></DD></DL><HR><A NAME="isClosing()"><!-- --></A><H3>isClosing</H3><PRE>boolean <B>isClosing</B>()</PRE><DL><DD>Returns <code>true</tt> if and only if this session is being closed (but not disconnected yet) or is closed.<P><DD><DL></DL></DD></DL><HR><A NAME="getCloseFuture()"><!-- --></A><H3>getCloseFuture</H3><PRE><A HREF="../../../../org/apache/mina/common/CloseFuture.html" title="interface in org.apache.mina.common">CloseFuture</A> <B>getCloseFuture</B>()</PRE><DL><DD>Returns the <A HREF="../../../../org/apache/mina/common/CloseFuture.html" title="interface in org.apache.mina.common"><CODE>CloseFuture</CODE></A> of this session. This method returns the same instance whenever user calls it.<P><DD><DL></DL></DD></DL><HR><A NAME="getRemoteAddress()"><!-- --></A><H3>getRemoteAddress</H3><PRE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/net/SocketAddress.html?is-external=true" title="class or interface in java.net">SocketAddress</A> <B>getRemoteAddress</B>()</PRE><DL><DD>Returns the socket address of remote peer.<P><DD><DL></DL></DD></DL><HR><A NAME="getLocalAddress()"><!-- --></A><H3>getLocalAddress</H3><PRE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/net/SocketAddress.html?is-external=true" title="class or interface in java.net">SocketAddress</A> <B>getLocalAddress</B>()</PRE><DL><DD>Returns the socket address of local machine which is associated with this session.<P><DD><DL></DL></DD></DL><HR><A NAME="getServiceAddress()"><!-- --></A><H3>getServiceAddress</H3><PRE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/net/SocketAddress.html?is-external=true" title="class or interface in java.net">SocketAddress</A> <B>getServiceAddress</B>()</PRE><DL><DD>Returns the socket address of the <A HREF="../../../../org/apache/mina/common/IoService.html" title="interface in org.apache.mina.common"><CODE>IoService</CODE></A> listens to to manage this session. If this session is managed by <A HREF="../../../../org/apache/mina/common/IoAcceptor.html" title="interface in org.apache.mina.common"><CODE>IoAcceptor</CODE></A>, it returns the <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/net/SocketAddress.html?is-external=true" title="class or interface in java.net"><CODE>SocketAddress</CODE></A> which is specified as a parameter of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -