in src/Commands/ActiveMQStreamMessage.cs [202:245]
public int ReadInt32()
{
InitializeReading();
try
{
long startingPos = this.byteBuffer.Position;
try
{
int type = this.dataIn.ReadByte();
switch (type)
{
case PrimitiveMap.INTEGER_TYPE:
return this.dataIn.ReadInt32();
case PrimitiveMap.SHORT_TYPE:
return this.dataIn.ReadInt16();
case PrimitiveMap.BYTE_TYPE:
return this.dataIn.ReadByte();
case PrimitiveMap.STRING_TYPE:
return Int32.Parse(this.dataIn.ReadString16());
case PrimitiveMap.NULL:
this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
throw new NMSException("Cannot convert Null type to a int");
default:
this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
throw new MessageFormatException("Value is not a Int32 type.");
}
}
catch(FormatException e)
{
this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
throw NMSExceptionSupport.CreateMessageFormatException(e);
}
}
catch(EndOfStreamException e)
{
throw NMSExceptionSupport.CreateMessageEOFException(e);
}
catch(IOException e)
{
throw NMSExceptionSupport.CreateMessageFormatException(e);
}
}