streammessage.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 927 行 · 第 1/4 页

HTML
927
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Jan 17 03:51:32 PST 2002 -->
<TITLE>
Java 2 Platform EE v1.3: Interface  StreamMessage
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_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>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../javax/jms/Session.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../javax/jms/TemporaryQueue.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>  &nbsp;
&nbsp;<A HREF="StreamMessage.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.jms</FONT>
<BR>
Interface  StreamMessage</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD><A HREF="../../javax/jms/Message.html">Message</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>StreamMessage</B><DT>extends <A HREF="../../javax/jms/Message.html">Message</A></DL>

<P>
A <CODE>StreamMessage</CODE> object is used to send a stream of primitive
 types in the Java programming language. It is filled and read sequentially.
 It inherits from the <CODE>Message</CODE> interface
 and adds a stream message body. Its methods are based largely on those
 found in <CODE>java.io.DataInputStream</CODE> and
 <CODE>java.io.DataOutputStream</CODE>.

 <P>The primitive types can be read or written explicitly using methods
 for each type. They may also be read or written generically as objects.
 For instance, a call to <CODE>StreamMessage.writeInt(6)</CODE> is
 equivalent to <CODE>StreamMessage.writeObject(new Integer(6))</CODE>.
 Both forms are provided, because the explicit form is convenient for
 static programming, and the object form is needed when types are not known
 at compile time.

 <P>When the message is first created, and when <CODE>clearBody</CODE>
 is called, the body of the message is in write-only mode. After the 
 first call to <CODE>reset</CODE> has been made, the message body is in 
 read-only mode. 
 After a message has been sent, the client that sent it can retain and 
 modify it without affecting the message that has been sent. The same message
 object can be sent multiple times.
 When a message has been received, the provider has called 
 <CODE>reset</CODE> so that the message body is in read-only mode for the client.
 
 <P>If <CODE>clearBody</CODE> is called on a message in read-only mode, 
 the message body is cleared and the message body is in write-only mode.
 
 <P>If a client attempts to read a message in write-only mode, a 
 <CODE>MessageNotReadableException</CODE> is thrown.
 
 <P>If a client attempts to write a message in read-only mode, a 
 <CODE>MessageNotWriteableException</CODE> is thrown.

 <P><CODE>StreamMessage</CODE> objects support the following conversion 
 table. The marked cases must be supported. The unmarked cases must throw a 
 <CODE>JMSException</CODE>. The <CODE>String</CODE>-to-primitive conversions 
 may throw a runtime exception if the primitive's <CODE>valueOf()</CODE> 
 method does not accept it as a valid <CODE>String</CODE> representation of 
 the primitive.

 <P>A value written as the row type can be read as the column type.

 <PRE>
 |        | boolean byte short char int long float double String byte[]
 |----------------------------------------------------------------------
 |boolean |    X                                            X
 |byte    |          X     X         X   X                  X   
 |short   |                X         X   X                  X   
 |char    |                     X                           X
 |int     |                          X   X                  X   
 |long    |                              X                  X   
 |float   |                                    X     X      X   
 |double  |                                          X      X   
 |String  |    X     X     X         X   X     X     X      X   
 |byte[]  |                                                        X
 |----------------------------------------------------------------------
 </PRE>

 <P>Attempting to read a null value as a primitive type must be treated
 as calling the primitive's corresponding <code>valueOf(String)</code> 
 conversion method with a null value. Since <code>char</code> does not 
 support a <code>String</code> conversion, attempting to read a null value 
 as a <code>char</code> must throw a <code>NullPointerException</code>.
<P>
<DL>
<DT><B>See Also: </B><DD><A HREF="../../javax/jms/Session.html#createStreamMessage()"><CODE>Session.createStreamMessage()</CODE></A>, 
<A HREF="../../javax/jms/BytesMessage.html"><CODE>BytesMessage</CODE></A>, 
<A HREF="../../javax/jms/MapMessage.html"><CODE>MapMessage</CODE></A>, 
<A HREF="../../javax/jms/Message.html"><CODE>Message</CODE></A>, 
<A HREF="../../javax/jms/ObjectMessage.html"><CODE>ObjectMessage</CODE></A>, 
<A HREF="../../javax/jms/TextMessage.html"><CODE>TextMessage</CODE></A></DL>
<HR>

<P>
<!-- ======== INNER CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->

<A NAME="fields_inherited_from_class_javax.jms.Message"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from interface javax.jms.<A HREF="../../javax/jms/Message.html">Message</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../javax/jms/Message.html#DEFAULT_DELIVERY_MODE">DEFAULT_DELIVERY_MODE</A>, <A HREF="../../javax/jms/Message.html#DEFAULT_PRIORITY">DEFAULT_PRIORITY</A>, <A HREF="../../javax/jms/Message.html#DEFAULT_TIME_TO_LIVE">DEFAULT_TIME_TO_LIVE</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->


<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/StreamMessage.html#readBoolean()">readBoolean</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a <code>boolean</code> from the stream message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/StreamMessage.html#readByte()">readByte</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a <code>byte</code> value from the stream message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/StreamMessage.html#readBytes(byte[])">readBytes</A></B>(byte[]&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a byte array field from the stream message into the 
 specified <CODE>byte[]</CODE> object (the read buffer).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;char</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/StreamMessage.html#readChar()">readChar</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a Unicode character value from the stream message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/StreamMessage.html#readDouble()">readDouble</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a <code>double</code> from the stream message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;float</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/StreamMessage.html#readFloat()">readFloat</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a <code>float</code> from the stream message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/StreamMessage.html#readInt()">readInt</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a 32-bit integer from the stream message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/jms/StreamMessage.html#readLong()">readLong</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads a 64-bit integer from the stream message.</TD>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?