📄 messageconnection.html
字号:
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="newMessage(int)"><!-- --></A><H3>
newMessage</H3>
<PRE>
public <A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A> <B>newMessage</B>(int type)</PRE>
<DL>
<DD><p>Constructs a new message object of a given type. </p> <p>When this method is called from a 'client' mode connection, the newly created Message has the destination address set to the address identified when this Connection was created. </p> <p>When this method is called from a 'server' mode connection, the newly created Message does not have the destination address set. It must be set by the application before trying to send the message. </p>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>type</CODE> - the type of message to be created. There are constants for basic types defined in this interface<DT><B>Returns:</B><DD>Message object for a given type of message</DL>
</DD>
</DL>
<HR>
<A NAME="newMessage(int, java.lang.String)"><!-- --></A><H3>
newMessage</H3>
<PRE>
public <A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A> <B>newMessage</B>(int type, java.lang.String address)</PRE>
<DL>
<DD><p>Constructs a new message object of a given type and initializes it with the given destination address. </p>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>type</CODE> - the type of message to be created. There are constants for basic types defined in this interface<DD><CODE>address</CODE> - destination address for the new message<DT><B>Returns:</B><DD>Message object for a given type of message</DL>
</DD>
</DL>
<HR>
<A NAME="send(com.nokia.mid.messaging.Message)"><!-- --></A><H3>
send</H3>
<PRE>
public void <B>send</B>(<A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A> msg) throws java.io.IOException, java.io.InterruptedIOException</PRE>
<DL>
<DD><p>Sends the message </p>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>msg</CODE> - the message to be sent<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if the message could not be sent, because of a network communication failure.<DD><CODE>java.lang.InvalidArgumentException</CODE> - if the message could not be sent, because of invalid information in the Message object. This exception is also thrown if the payload of the message exceeds the maximum length for the given messaging protocol.<DD><CODE>java.io.InterruptedIOException</CODE> - if a timeout occurs while trying to send the message or if this Connection object is closed during this send operation<DD><CODE>java.lang.SecurityException</CODE> - if the application does not have a permission to send the message</DL>
</DD>
</DL>
<HR>
<A NAME="receive()"><!-- --></A><H3>
receive</H3>
<PRE>
public <A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A> <B>receive</B>() throws java.io.IOException, java.io.InterruptedIOException</PRE>
<DL>
<DD><p>Receives a message </p> <p>If there are no Messages for this Connection waiting, this message will block until a message for this Connection is received, or the Connection is closed. </p>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a Message object representing the information in the received message<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an error occurs while receiving a message<DD><CODE>java.io.InterruptedIOException</CODE> - if this Connection object is closed during this receive method call<DD><CODE>java.lang.SecurityException</CODE> - if the application does not have a permission to receive messages using the given port number</DL>
</DD>
</DL>
<HR>
<A NAME="registerMessageListener(com.nokia.mid.messaging.MessageListener)"><!-- --></A><H3>
registerMessageListener</H3>
<PRE>
public void <B>registerMessageListener</B>(<A HREF="../../../../com/nokia/mid/messaging/MessageListener.html">MessageListener</A> l) throws java.io.IOException</PRE>
<DL>
<DD><p>Registers a MessageListener object. </p> <p>The platform will notify this listener object when a message has been received to this MessageConnection. </p> <p>If there are incoming messages in the queue of this MessageConnection that have not been retrieved by the the application prior to calling this method, the newly registered listener object will be notified immediately once for each such income message in the queue. </p> <p>There can be at most one listener object registered for a MessageConnection object at any given point in time. </p> <p>The currently registered listener can be de-registered by passing in null as the parameter. If null is passed and there is no currently registered listener, the call has no effect.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>l</CODE> - MessageListener object to be registered; if null, the currently registered listener object will be de-registered and will no longer receive events<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if a listener object has already been registered with this MessageConnection<DD><CODE>java.lang.SecurityException</CODE> - if the application does not have a permission to receive messages using the given port number</DL>
</DD>
</DL>
<HR>
<A NAME="numberOfMessages(com.nokia.mid.messaging.Message)"><!-- --></A><H3>
numberOfMessages</H3>
<PRE>
public int <B>numberOfMessages</B>(<A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A> msg)</PRE>
<DL>
<DD><p>Returns how many SMS messages will be needed for sending the Message given as the parameter. </p> <p>Note that this method does not actually send the message, it will only calculate the number of SMS messages needed for sending the message. </p> <p>This method will calculate the number of messages needed when this message is split into the SMS messages using the concatenation mechanisms provided by the GSM SMS protocol. This method does not take into account possible limitations of the implementation that may limit the number of SMS messages that can be sent using this feature. </p> <p> This specification guarantees only that implementations are able to send and receive messages that use up to 3 SMS protocol messages. Thus, if this method returns a value larger than 3, the application is not advised to send the message unless it has reason to believe that the recipient is able to handle the indicated number of messages </p>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>msg</CODE> - the message to be used for the calculation<DT><B>Returns:</B><DD>number of SMS messages needed for sending the message. Returns 0 if the Message object can not be sent as GSM SMS at all.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<a href=http://forum.nokia.com/java target=_top>forum.nokia.com/java</a></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/nokia/mid/messaging/Message.html"><B>PREV CLASS</B></A>
<A HREF="../../../../com/nokia/mid/messaging/MessageListener.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="MessageConnection.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT><A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<font size=-1>Copyright (c) 2002 Nokia Mobile Phones. All Rights Reserved.<br/>Java is a trademark or registered trademark of Sun Microsystems, Inc.
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -