資源簡介

代碼片段和文件信息
//?Message.java
//?------------------------------------------------------------------
//
//?Copyright?(c)?2006-2010?Dino?Chiesa.
//?All?rights?reserved.
//
//?This?code?module?is?part?of?MsmqJava?a?JNI?library?that?provides
//?access?to?MSMQ?for?Java?on?Windows.
//
//?------------------------------------------------------------------
//
//?This?code?is?licensed?under?the?Microsoft?Public?License.
//?See?the?file?License.txt?for?the?license?details.
//?More?info?on:?http://dotnetzip.codeplex.com
//
//?------------------------------------------------------------------
//
//?last?saved?(in?emacs):
//?Time-stamp:?<2010-March-28?15:17:56>
//
//?------------------------------------------------------------------
//
//?This?module?represents?a?Message?object.
//
//?------------------------------------------------------------------
package?ionic.Msmq;
/**
?*?The?Message?class?models?a?message?that?is?sent?to?or?receive?from?an
?*?MSMQ?queue.??It?exposes?several?properties?that?are?known?to?MSMQ
?*?including?the?message?label?the?message?correlationId?and?the
?*?message?body.
?*
?*?The?maximum?size?for?an?MSMQ?4.0?message?is?slightly?less?than?4
?*?MB.?If?you?try?to?send?a?message?that?exceeds?the?maximum?size?you
?*?will?receive?a?MessageQueueException?with?hr?=
?*?MQ_ERROR_INSUFFICIENT_RESOURCES?(0xC00E0027).
?*
?*/
public?class?Message?{
????private?static?String?_encoding?=?“UTF-16LE“;
????private?static?String?_utf8?=?“UTF-8“;
????byte[]?_messageBody?;
????String?_label?;
????byte[]?_correlationId?;?//?up?to?PROPID_M_CORRELATIONID_SIZE?bytes
????boolean?_highPriority;
????/**
?????*?Sets?the?message?body?as?a?string.
?????*
?????*?The?string?will?be?encoded?as?UTF-16LE?with?no?byte-order-mark.
?????*?This?information?may?be?useful?if?you?use?different?libraries?on?the
?????*?the?receiving?and?sending?side.?
?????*
?????*?@param??value????the?string?to?use?for?the?Message?body
?????*?@see????#setBody(byte[])
?????*/
????public?void?setBodyAsString(String?value)
????????throws?java.io.UnsupportedEncodingException
????{?_messageBody=?value.getBytes(_encoding);?}
????/**
?????*?Gets?the?message?body?as?a?string.
?????*
?????*?The?string?will?be?decoded?as?UTF-16LE?with?no?byte-order-mark.
?????*?This?is?mostly?useful?after?receiving?a?message.?
?????*
?????*?If?the?message?body?is?not?a?legal?UTF-16LE?bytestream?then?this
?????*?method?will?return?a?rubbish?string.
?????*
?????*?@return?the?message?body?as?a?string.
?????*?@see????#getBody()
?????*/
????public?String?getBodyAsString()
????????throws?java.io.UnsupportedEncodingException
????{?return?new?String(_messageBody?_encoding);?}
????/**
?????*?Sets?the?correlation?Id?on?the?message.?
?????*
?????*?MSMQ?specifies?that?the?ID?should?be?a?byte?array?of?20?bytes
?????*?in?length.?But?callers?can?use?this?convenience?method?to?use?a
????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\
?????文件?????????293??2019-04-19?15:11??TestMSMQ\.classpath
?????文件?????????384??2019-04-19?15:11??TestMSMQ\.project
?????文件???????16896??2019-04-19?15:11??TestMSMQ\MsmqJava.dll
?????文件???????16896??2019-04-19?15:11??TestMSMQ\MsmqJava64.dll
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\bin\
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\bin\ionic\
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\bin\ionic\Msmq\
?????文件????????2819??2019-04-19?15:11??TestMSMQ\bin\ionic\Msmq\Message.class
?????文件????????2170??2019-04-19?15:11??TestMSMQ\bin\ionic\Msmq\MessageQueueException.class
?????文件????????1296??2019-04-19?15:11??TestMSMQ\bin\ionic\Msmq\Queue$Access.class
?????文件????????5609??2019-04-19?15:11??TestMSMQ\bin\ionic\Msmq\Queue.class
?????文件????????1287??2019-04-19?15:11??TestMSMQ\bin\ionic\Msmq\TransactionType.class
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\bin\test\
?????文件????????1469??2019-04-19?15:11??TestMSMQ\bin\test\SimpleReceiveMSMQ.class
?????文件????????1575??2019-04-19?15:11??TestMSMQ\bin\test\SimpleSendMSMQ.class
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\lib\
?????文件????????6198??2019-04-19?15:11??TestMSMQ\lib\MsmqJava.jar
?????文件???????14336??2019-04-19?15:11??TestMSMQ\lib\MsmqJava32.dll
?????文件???????16896??2019-04-19?15:11??TestMSMQ\lib\MsmqJava64.dll
?????文件???????14674??2019-04-19?15:11??TestMSMQ\lib\MsmqJavaModify.jar
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\src\
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\src\ionic\
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\src\ionic\Msmq\
?????文件???????11249??2019-04-19?15:11??TestMSMQ\src\ionic\Msmq\Message.java
?????文件????????3631??2019-04-19?15:11??TestMSMQ\src\ionic\Msmq\MessageQueueException.java
?????文件???????13432??2019-04-19?15:11??TestMSMQ\src\ionic\Msmq\Queue.java
?????文件?????????296??2019-04-19?15:11??TestMSMQ\src\ionic\Msmq\TransactionType.java
?????目錄???????????0??2019-04-19?15:11??TestMSMQ\src\test\
?????文件????????1140??2019-04-19?15:11??TestMSMQ\src\test\SimpleReceiveMSMQ.java
?????文件????????1456??2019-04-19?15:11??TestMSMQ\src\test\SimpleSendMSMQ.java
............此處省略0個文件信息
- 上一篇:java語言與面向對象程序設計課后習題答案
- 下一篇:JSP開發的網絡書店以及論文
評論
共有 條評論