Apache.NMS.ActiveMQ.OpenWire.BooleanStream.WriteBoolean C# (CSharp) Method

WriteBoolean() public method

public WriteBoolean ( bool value ) : void
value bool
return void
        public void WriteBoolean(bool value)
        {
            if (bytePos == 0)
            {
                arrayLimit++;
                if (arrayLimit >= data.Length)
                {
                    // re-grow the array.
                    byte[] d = new byte[data.Length * 2];
                    Array.Copy(data, d, data.Length);
                    data = d;
                }
            }
            if (value)
            {
                data[arrayPos] |= (byte) (0x01 << bytePos);
            }
            bytePos++;
            if (bytePos >= 8)
            {
                bytePos = 0;
                arrayPos++;
            }
        }

Usage Example

Beispiel #1
0
        public int TightMarshalNestedObject1(DataStructure o, BooleanStream bs)
        {
            bs.WriteBoolean(o != null);
            if (null == o)
            {
                return(0);
            }

            if (o.IsMarshallAware())
            {
                MarshallAware ma       = (MarshallAware)o;
                byte[]        sequence = ma.GetMarshalledForm(this);
                bs.WriteBoolean(sequence != null);
                if (sequence != null)
                {
                    return(1 + sequence.Length);
                }
            }

            byte type = o.GetDataStructureType();

            if (type == 0)
            {
                throw new IOException("No valid data structure type for: " + o + " of type: " + o.GetType());
            }

            BaseDataStreamMarshaller dsm = GetDataStreamMarshallerForType(type);

            Tracer.Debug("Marshalling type: " + type + " with structure: " + o);
            return(1 + dsm.TightMarshal1(this, o, bs));
        }
All Usage Examples Of Apache.NMS.ActiveMQ.OpenWire.BooleanStream::WriteBoolean