本文整理汇总了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);
}
示例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);
}
示例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();
}
}