當前位置: 首頁>>代碼示例>>Java>>正文


Java MapMessage.getBytes方法代碼示例

本文整理匯總了Java中javax.jms.MapMessage.getBytes方法的典型用法代碼示例。如果您正苦於以下問題:Java MapMessage.getBytes方法的具體用法?Java MapMessage.getBytes怎麽用?Java MapMessage.getBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.jms.MapMessage的用法示例。


在下文中一共展示了MapMessage.getBytes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: assertEquivalent

import javax.jms.MapMessage; //導入方法依賴的package包/類
@Override
protected void assertEquivalent(final Message m, final int mode, final boolean redelivery) throws JMSException {
   super.assertEquivalent(m, mode, redelivery);

   MapMessage mm = (MapMessage) m;

   ProxyAssertSupport.assertEquals(true, mm.getBoolean("boolean"));
   ProxyAssertSupport.assertEquals((byte) 3, mm.getByte("byte"));
   byte[] bytes = mm.getBytes("bytes");
   ProxyAssertSupport.assertEquals((byte) 3, bytes[0]);
   ProxyAssertSupport.assertEquals((byte) 4, bytes[1]);
   ProxyAssertSupport.assertEquals((byte) 5, bytes[2]);
   ProxyAssertSupport.assertEquals((char) 6, mm.getChar("char"));
   ProxyAssertSupport.assertEquals(new Double(7.0), new Double(mm.getDouble("double")));
   ProxyAssertSupport.assertEquals(new Float(8.0f), new Float(mm.getFloat("float")));
   ProxyAssertSupport.assertEquals(9, mm.getInt("int"));
   ProxyAssertSupport.assertEquals(10L, mm.getLong("long"));
   ProxyAssertSupport.assertEquals("this is an object", mm.getObject("object"));
   ProxyAssertSupport.assertEquals((short) 11, mm.getShort("short"));
   ProxyAssertSupport.assertEquals("this is a string", mm.getString("string"));
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:22,代碼來源:MapMessageTest.java

示例2: receiveMapMessage

import javax.jms.MapMessage; //導入方法依賴的package包/類
private void receiveMapMessage(boolean useCore) throws Exception {
   MapMessage mapMessage = (MapMessage) receiveMessage(useCore);

   boolean booleanVal = mapMessage.getBoolean("boolean-type");
   assertTrue(booleanVal);
   byte byteVal = mapMessage.getByte("byte-type");
   assertEquals((byte) 10, byteVal);
   byte[] bytesVal = mapMessage.getBytes("bytes-type");
   byte[] originVal = TEXT.getBytes();
   assertEquals(originVal.length, bytesVal.length);
   for (int i = 0; i < bytesVal.length; i++) {
      assertTrue(bytesVal[i] == originVal[i]);
   }
   char charVal = mapMessage.getChar("char-type");
   assertEquals('A', charVal);
   double doubleVal = mapMessage.getDouble("double-type");
   assertEquals(55.3D, doubleVal, 0.1D);
   float floatVal = mapMessage.getFloat("float-type");
   assertEquals(79.1F, floatVal, 0.1F);
   int intVal = mapMessage.getInt("int-type");
   assertEquals(37, intVal);
   long longVal = mapMessage.getLong("long-type");
   assertEquals(56652L, longVal);
   Object objectVal = mapMessage.getObject("object-type");
   Object origVal = new String("VVVV");
   assertTrue(objectVal.equals(origVal));
   short shortVal = mapMessage.getShort("short-type");
   assertEquals((short) 333, shortVal);
   String strVal = mapMessage.getString("string-type");
   assertEquals(TEXT, strVal);
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:32,代碼來源:CompressedInteropTest.java


注:本文中的javax.jms.MapMessage.getBytes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。