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

ReadDouble() public method

public ReadDouble ( ) : double
return double
        public double ReadDouble()
        {
            InitializeReading();

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

                    if(type == PrimitiveMap.DOUBLE_TYPE)
                    {
                        return this.dataIn.ReadDouble();
                    }
                    else if(type == PrimitiveMap.FLOAT_TYPE)
                    {
                        return this.dataIn.ReadSingle();
                    }
                    else if(type == PrimitiveMap.STRING_TYPE)
                    {
                        return Single.Parse(this.dataIn.ReadString16());
                    }
                    else if(type == PrimitiveMap.NULL)
                    {
                        this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
                        throw new NMSException("Cannot convert Null type to a double");
                    }
                    else
                    {
                        this.byteBuffer.Seek(startingPos, SeekOrigin.Begin);
                        throw new MessageFormatException("Value is not a Double 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);
            }
        }