当前位置: 首页>>代码示例>>Java>>正文


Java StreamMessage.readInt方法代码示例

本文整理汇总了Java中javax.jms.StreamMessage.readInt方法的典型用法代码示例。如果您正苦于以下问题:Java StreamMessage.readInt方法的具体用法?Java StreamMessage.readInt怎么用?Java StreamMessage.readInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jms.StreamMessage的用法示例。


在下文中一共展示了StreamMessage.readInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: receiveStreamMessage

import javax.jms.StreamMessage; //导入方法依赖的package包/类
private void receiveStreamMessage(boolean useCore) throws Exception {
   StreamMessage streamMessage = (StreamMessage) receiveMessage(useCore);
   boolean booleanVal = streamMessage.readBoolean();
   assertTrue(booleanVal);
   byte byteVal = streamMessage.readByte();
   assertEquals((byte) 10, byteVal);
   byte[] originVal = TEXT.getBytes();
   byte[] bytesVal = new byte[originVal.length];
   streamMessage.readBytes(bytesVal);
   for (int i = 0; i < bytesVal.length; i++) {
      assertTrue(bytesVal[i] == originVal[i]);
   }
   char charVal = streamMessage.readChar();
   assertEquals('A', charVal);
   double doubleVal = streamMessage.readDouble();
   assertEquals(55.3D, doubleVal, 0.1D);
   float floatVal = streamMessage.readFloat();
   assertEquals(79.1F, floatVal, 0.1F);
   int intVal = streamMessage.readInt();
   assertEquals(37, intVal);
   long longVal = streamMessage.readLong();
   assertEquals(56652L, longVal);
   Object objectVal = streamMessage.readObject();
   Object origVal = new String("VVVV");
   assertTrue(objectVal.equals(origVal));
   short shortVal = streamMessage.readShort();
   assertEquals((short) 333, shortVal);
   String strVal = streamMessage.readString();
   assertEquals(TEXT, strVal);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:31,代码来源:CompressedInteropTest.java

示例2: process

import javax.jms.StreamMessage; //导入方法依赖的package包/类
@Override
public void process(Exchange exchange) throws Exception {
    log.info("Got exchange id={}", exchange.getExchangeId());
    final StreamMessage message = exchange.getIn().getBody(StreamMessage.class);
    final Greeting greeting = new Greeting(message.readString(), message.readInt());
    log.info("- Parsed {}", greeting);
    greetingSinkService.putGreeting(greeting);
}
 
开发者ID:avshabanov,项目名称:spring-camel-demo,代码行数:9,代码来源:GreetingHandler.java

示例3: checkConversionsFail

import javax.jms.StreamMessage; //导入方法依赖的package包/类
private void checkConversionsFail(StreamMessage sm, int[] conversions) throws JMSException
{
    for (int conversion : conversions)
    {
        try
        {
            switch (conversion)
            {
                case 0:
                    sm.readBoolean();
                    break;
                case 1:
                    sm.readByte();
                    break;
                case 2:
                    sm.readShort();
                    break;
                case 3:
                    sm.readChar();
                    break;
                case 4:
                    sm.readInt();
                    break;
                case 5:
                    sm.readLong();
                    break;
                case 6:
                    sm.readFloat();
                    break;
                case 7:
                    sm.readDouble();
                    break;
                case 8:
                    sm.readString();
                    break;
                case 9:
                    sm.readBytes(new byte[3]);
                    break;
            }
            fail("MessageFormatException was not thrown");
        }
        catch (MessageFormatException e)
        {
            // PASS
        }
        sm.reset();
    }
}
 
开发者ID:wso2,项目名称:andes,代码行数:49,代码来源:StreamMessageTest.java


注:本文中的javax.jms.StreamMessage.readInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。