📄 iosession.html
字号:
<a name="124" href="#124">124</a> <em class="jxr_javadoccomment"> * is not the address of the server in case of broadcasting, there should be a</em><a name="125" href="#125">125</a> <em class="jxr_javadoccomment"> * way to specify the destination when you write the response message.</em><a name="126" href="#126">126</a> <em class="jxr_javadoccomment"> * This interface provides {@link #write(Object, SocketAddress)} method so you</em><a name="127" href="#127">127</a> <em class="jxr_javadoccomment"> * can specify the destination.</em><a name="128" href="#128">128</a> <em class="jxr_javadoccomment"> *</em><a name="129" href="#129">129</a> <em class="jxr_javadoccomment"> * @param destination <tt>null</tt> if you want the message sent to the</em><a name="130" href="#130">130</a> <em class="jxr_javadoccomment"> * default remote address</em><a name="131" href="#131">131</a> <em class="jxr_javadoccomment"> *</em><a name="132" href="#132">132</a> <em class="jxr_javadoccomment"> * @throws UnsupportedOperationException if this operation is not supported</em><a name="133" href="#133">133</a> <em class="jxr_javadoccomment"> */</em><a name="134" href="#134">134</a> <a href="../../../../org/apache/mina/common/WriteFuture.html">WriteFuture</a> write(Object message, SocketAddress destination);<a name="135" href="#135">135</a> <a name="136" href="#136">136</a> <em class="jxr_javadoccomment">/**</em><a name="137" href="#137">137</a> <em class="jxr_javadoccomment"> * Closes this session immediately. This operation is asynchronous.</em><a name="138" href="#138">138</a> <em class="jxr_javadoccomment"> * Wait for the returned {@link CloseFuture} if you want to wait for</em><a name="139" href="#139">139</a> <em class="jxr_javadoccomment"> * the session actually closed.</em><a name="140" href="#140">140</a> <em class="jxr_javadoccomment"> */</em><a name="141" href="#141">141</a> <a href="../../../../org/apache/mina/common/CloseFuture.html">CloseFuture</a> close();<a name="142" href="#142">142</a> <a name="143" href="#143">143</a> <em class="jxr_javadoccomment">/**</em><a name="144" href="#144">144</a> <em class="jxr_javadoccomment"> * Closes this session after all queued write requests are flushed.</em><a name="145" href="#145">145</a> <em class="jxr_javadoccomment"> * This operation is asynchronous. Wait for the returned {@link CloseFuture}</em><a name="146" href="#146">146</a> <em class="jxr_javadoccomment"> * if you want to wait for the session actually closed.</em><a name="147" href="#147">147</a> <em class="jxr_javadoccomment"> */</em><a name="148" href="#148">148</a> <a href="../../../../org/apache/mina/common/CloseFuture.html">CloseFuture</a> closeOnFlush();<a name="149" href="#149">149</a> <a name="150" href="#150">150</a> <em class="jxr_javadoccomment">/**</em><a name="151" href="#151">151</a> <em class="jxr_javadoccomment"> * Closes this session immediately or after all queued write requests</em><a name="152" href="#152">152</a> <em class="jxr_javadoccomment"> * are flushed. This operation is asynchronous. Wait for the returned</em><a name="153" href="#153">153</a> <em class="jxr_javadoccomment"> * {@link CloseFuture} if you want to wait for the session actually closed.</em><a name="154" href="#154">154</a> <em class="jxr_javadoccomment"> *</em><a name="155" href="#155">155</a> <em class="jxr_javadoccomment"> * @param immediately {@code true} to close this session immediately</em><a name="156" href="#156">156</a> <em class="jxr_javadoccomment"> * (i.e. {@link #close()}).</em><a name="157" href="#157">157</a> <em class="jxr_javadoccomment"> * {@code false} to close this session after all queued</em><a name="158" href="#158">158</a> <em class="jxr_javadoccomment"> * write requests are flushed (i.e. {@link #closeOnFlush()}).</em><a name="159" href="#159">159</a> <em class="jxr_javadoccomment"> */</em><a name="160" href="#160">160</a> <a href="../../../../org/apache/mina/common/CloseFuture.html">CloseFuture</a> close(<strong class="jxr_keyword">boolean</strong> immediately);<a name="161" href="#161">161</a> <a name="162" href="#162">162</a> <em class="jxr_javadoccomment">/**</em><a name="163" href="#163">163</a> <em class="jxr_javadoccomment"> * Returns an attachment of this session.</em><a name="164" href="#164">164</a> <em class="jxr_javadoccomment"> * This method is identical with <tt>getAttribute( "" )</tt>.</em><a name="165" href="#165">165</a> <em class="jxr_javadoccomment"> * </em><a name="166" href="#166">166</a> <em class="jxr_javadoccomment"> * @deprecated Use {@link #getAttribute(Object)} instead.</em><a name="167" href="#167">167</a> <em class="jxr_javadoccomment"> */</em><a name="168" href="#168">168</a> @Deprecated Object getAttachment();<a name="169" href="#169">169</a> <a name="170" href="#170">170</a> <em class="jxr_javadoccomment">/**</em><a name="171" href="#171">171</a> <em class="jxr_javadoccomment"> * Sets an attachment of this session.</em><a name="172" href="#172">172</a> <em class="jxr_javadoccomment"> * This method is identical with <tt>setAttribute( "", attachment )</tt>.</em><a name="173" href="#173">173</a> <em class="jxr_javadoccomment"> *</em><a name="174" href="#174">174</a> <em class="jxr_javadoccomment"> * @return Old attachment. <tt>null</tt> if it is new.</em><a name="175" href="#175">175</a> <em class="jxr_javadoccomment"> * @deprecated Use {@link #setAttribute(Object, Object)} instead.</em><a name="176" href="#176">176</a> <em class="jxr_javadoccomment"> */</em><a name="177" href="#177">177</a> @Deprecated Object setAttachment(Object attachment);<a name="178" href="#178">178</a> <a name="179" href="#179">179</a> <em class="jxr_javadoccomment">/**</em><a name="180" href="#180">180</a> <em class="jxr_javadoccomment"> * Returns the value of the user-defined attribute of this session.</em><a name="181" href="#181">181</a> <em class="jxr_javadoccomment"> *</em><a name="182" href="#182">182</a> <em class="jxr_javadoccomment"> * @param key the key of the attribute</em><a name="183" href="#183">183</a> <em class="jxr_javadoccomment"> * @return <tt>null</tt> if there is no attribute with the specified key</em><a name="184" href="#184">184</a> <em class="jxr_javadoccomment"> */</em><a name="185" href="#185">185</a> Object getAttribute(Object key);<a name="186" href="#186">186</a> <a name="187" href="#187">187</a> <em class="jxr_javadoccomment">/**</em><a name="188" href="#188">188</a> <em class="jxr_javadoccomment"> * Returns the value of user defined attribute associated with the</em><a name="189" href="#189">189</a> <em class="jxr_javadoccomment"> * specified key. If there's no such attribute, the specified default</em><a name="190" href="#190">190</a> <em class="jxr_javadoccomment"> * value is associated with the specified key, and the default value is</em><a name="191" href="#191">191</a> <em class="jxr_javadoccomment"> * returned. This method is same with the following code except that the</em><a name="192" href="#192">192</a> <em class="jxr_javadoccomment"> * operation is performed atomically.</em><a name="193" href="#193">193</a> <em class="jxr_javadoccomment"> * <pre></em><a name="194" href="#194">194</a> <em class="jxr_javadoccomment"> * if (containsAttribute(key)) {</em><a name="195" href="#195">195</a> <em class="jxr_javadoccomment"> * return getAttribute(key);</em><a name="196" href="#196">196</a> <em class="jxr_javadoccomment"> * } else {</em><a name="197" href="#197">197</a> <em class="jxr_javadoccomment"> * setAttribute(key, defaultValue);</em><a name="198" href="#198">198</a> <em class="jxr_javadoccomment"> * return defaultValue;</em><a name="199" href="#199">199</a> <em class="jxr_javadoccomment"> * }</em><a name="200" href="#200">200</a> <em class="jxr_javadoccomment"> * </pre></em><a name="201" href="#201">201</a> <em class="jxr_javadoccomment"> */</em><a name="202" href="#202">202</a> Object getAttribute(Object key, Object defaultValue);<a name="203" href="#203">203</a> <a name="204" href="#204">204</a> <em class="jxr_javadoccomment">/**</em><a name="205" href="#205">205</a> <em class="jxr_javadoccomment"> * Sets a user-defined attribute.</em><a name="206" href="#206">206</a> <em class="jxr_javadoccomment"> *</em><a name="207" href="#207">207</a> <em class="jxr_javadoccomment"> * @param key the key of the attribute</em><a name="208" href="#208">208</a> <em class="jxr_javadoccomment"> * @param value the value of the attribute</em><a name="209" href="#209">209</a> <em class="jxr_javadoccomment"> * @return The old value of the attribute. <tt>null</tt> if it is new.</em><a name="210" href="#210">210</a> <em class="jxr_javadoccomment"> */</em><a name="211" href="#211">211</a> Object setAttribute(Object key, Object value);<a name="212" href="#212">212</a> <a name="213" href="#213">213</a> <em class="jxr_javadoccomment">/**</em><a name="214" href="#214">214</a> <em class="jxr_javadoccomment"> * Sets a user defined attribute without a value. This is useful when</em><a name="215" href="#215">215</a> <em class="jxr_javadoccomment"> * you just want to put a 'mark' attribute. Its value is set to</em><a name="216" href="#216">216</a> <em class="jxr_javadoccomment"> * {@link Boolean#TRUE}.</em><a name="217" href="#217">217</a> <em class="jxr_javadoccomment"> *</em><a name="218" href="#218">218</a> <em class="jxr_javadoccomment"> * @param key the key of the attribute</em><a name="219" href="#219">219</a> <em class="jxr_javadoccomment"> * @return The old value of the attribute. <tt>null</tt> if it is new.</em><a name="220" href="#220">220</a> <em class="jxr_javadoccomment"> */</em><a name="221" href="#221">221</a> Object setAttribute(Object key);<a name="222" href="#222">222</a> <a name="223" href="#223">223</a> <em class="jxr_javadoccomment">/**</em><a name="224" href="#224">224</a> <em class="jxr_javadoccomment"> * Sets a user defined attribute if the attribute with the specified key</em><a name="225" href="#225">225</a> <em class="jxr_javadoccomment"> * is not set yet. This method is same with the following code except</em><a name="226" href="#226">226</a> <em class="jxr_javadoccomment"> * that the operation is performed atomically.</em><a name="227" href="#227">227</a> <em class="jxr_javadoccomment"> * <pre></em><a name="228" href="#228">228</a> <em class="jxr_javadoccomment"> * if (containsAttribute(key)) {</em><a name="229" href="#229">229</a> <em class="jxr_javadoccomment"> * return getAttribute(key);</em><a name="230" href="#230">230</a> <em class="jxr_javadoccomment"> * } else {</em><a name="231" href="#231">231</a> <em class="jxr_javadoccomment"> * return setAttribute(key, value);</em><a name="232" href="#232">232</a> <em class="jxr_javadoccomment"> * }</em><a name="233" href="#233">233</a> <em class="jxr_javadoccomment"> * </pre></em><a name="234" href="#234">234</a> <em class="jxr_javadoccomment"> */</em><a name="235" href="#235">235</a> Object setAttributeIfAbsent(Object key, Object value);<a name="236" href="#236">236</a> <a name="237" href="#237">237</a> <em class="jxr_javadoccomment">/**</em><a name="238" href="#238">238</a> <em class="jxr_javadoccomment"> * Sets a user defined attribute without a value if the attribute with</em><a name="239" href="#239">239</a> <em class="jxr_javadoccomment"> * the specified key is not set yet. This is useful when you just want to</em><a name="240" href="#240">240</a> <em class="jxr_javadoccomment"> * put a 'mark' attribute. Its value is set to {@link Boolean#TRUE}.</em><a name="241" href="#241">241</a> <em class="jxr_javadoccomment"> * This method is same with the following code except that the operation</em><a name="242" href="#242">242</a> <em class="jxr_javadoccomment"> * is performed atomically.</em><a name="243" href="#243">243</a> <em class="jxr_javadoccomment"> * <pre></em><a name="244" href="#244">244</a> <em class="jxr_javadoccomment"> * if (containsAttribute(key)) {</em><a name="245" href="#245">245</a> <em class="jxr_javadoccomment"> * return getAttribute(key); // might not always be Boolean.TRUE.</em><a name="246" href="#246">246</a> <em class="jxr_javadoccomment"> * } else {</em><a name="247" href="#247">247</a> <em class="jxr_javadoccomment"> * return setAttribute(key);</em><a name="248" href="#248">248</a> <em class="jxr_javadoccomment"> * }</em><a name="249" href="#249">249</a> <em class="jxr_javadoccomment"> * </pre></em><a name="250" href="#250">250</a> <em class="jxr_javadoccomment"> */</em><a name="251" href="#251">251</a> Object setAttributeIfAbsent(Object key);<a name="252" href="#252">252</a> <a name="253" href="#253">253</a> <em class="jxr_javadoccomment">/**</em><a name="254" href="#254">254</a> <em class="jxr_javadoccomment"> * Removes a user-defined attribute with the specified key.</em><a name="255" href="#255">255</a> <em class="jxr_javadoccomment"> *</em><a name="256" href="#256">256</a> <em class="jxr_javadoccomment"> * @return The old value of the attribute. <tt>null</tt> if not found.</em>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -