Apache.NMS.ActiveMQ.Commands.ActiveMQStreamMessage.WriteBoolean C# (CSharp) Method

WriteBoolean() public method

public WriteBoolean ( bool value ) : void
value bool
return void
        public void WriteBoolean(bool value)
        {
            InitializeWriting();
            try
            {
                this.dataOut.Write(PrimitiveMap.BOOLEAN_TYPE);
                this.dataOut.Write(value);
            }
            catch(IOException e)
            {
                NMSExceptionSupport.Create(e);
            }
        }

Usage Example

        public void TestReadBoolean()
        {
            ActiveMQStreamMessage msg = new ActiveMQStreamMessage();

            msg.WriteBoolean(true);
            msg.Reset();
            Assert.IsTrue(msg.ReadBoolean());
            msg.Reset();
            Assert.IsTrue(msg.ReadString() == "True");

            msg.Reset();
            try
            {
                msg.ReadByte();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadInt16();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadInt32();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadInt64();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadSingle();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadDouble();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadChar();
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            msg.Reset();
            try
            {
                msg.ReadBytes(new byte[1]);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }
        }
All Usage Examples Of Apache.NMS.ActiveMQ.Commands.ActiveMQStreamMessage::WriteBoolean