Apache.NMS.Commands.StreamMessage.ReadInt64 C# (CSharp) Method

ReadInt64() public method

public ReadInt64 ( ) : long
return long
        public long ReadInt64()
        {
            InitializeReading();

            try
            {
                long startingPos = this.byteBuffer.Position;
                try
                {
                    int type = this.dataIn.ReadByte();

                    if(type == PrimitiveMap.LONG_TYPE)
                    {
                        return this.dataIn.ReadInt64();
                    }
                    else if(type == PrimitiveMap.INTEGER_TYPE)
                    {
                        return this.dataIn.ReadInt32();
                    }
                    else if(type == PrimitiveMap.SHORT_TYPE)
                    {
                        return this.dataIn.ReadInt16();
                    }
                    else if(type == PrimitiveMap.BYTE_TYPE)
                    {
                        return this.dataIn.ReadByte();
                    }
                    else if(type == PrimitiveMap.STRING_TYPE)
                    {
                        return Int64.Parse(this.dataIn.ReadString16());
                    }
                    else if(type == PrimitiveMap.NULL)
                    {
                        this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
                        throw new NMSException("Cannot convert Null type to a long");
                    }
                    else
                    {
                        this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
                        throw new MessageFormatException("Value is not a Int64 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);
            }
        }