Esempio n. 1
0
        public IAdaptingType read(FlashorbBinaryReader reader, ParseContext parseContext)
        {
            int dataLength = reader.ReadInteger();

            byte[] buffer = reader.ReadBytes(dataLength);
            return(new StringType(Encoding.UTF8.GetString(buffer, 0, buffer.Length)));
        }
Esempio n. 2
0
        private Body readBodyPart(FlashorbBinaryReader reader)
        {
            int serviceURILength = reader.ReadUnsignedShort();

#if (FULL_BUILD)
            string serviceURI = encoding.GetString(reader.ReadBytes(serviceURILength));
#else
            string serviceURI = BitConverter.ToString(reader.ReadBytes(serviceURILength));
#endif
            int responseURILength = reader.ReadUnsignedShort();
#if (FULL_BUILD)
            string responseURI = encoding.GetString(reader.ReadBytes(responseURILength));
#else
            string responseURI = BitConverter.ToString(reader.ReadBytes(responseURILength));
#endif
            int length = reader.ReadInteger();

            if (Log.isLogging(LoggingConstants.DEBUG))
            {
                Log.log(LoggingConstants.DEBUG, "MessageReader::readBodyPart: serviceURI - " + serviceURI + " responseURI - " + responseURI + " length: " + length);
            }

            return(new Body(serviceURI, responseURI, length, readData(reader)));
        }
Esempio n. 3
0
        private Header readHeader(FlashorbBinaryReader reader)
        {
            int nameLength = reader.ReadUnsignedShort();

            byte[] bytes = reader.ReadBytes(nameLength);
#if (FULL_BUILD)
            string headerName = encoding.GetString(bytes);
#else
            string headerName = BitConverter.ToString(bytes);
#endif
            bool mustUnderstand = reader.ReadBoolean();
            //int length = reader.ReadInt32();
            int length = reader.ReadInteger();

            if (Log.isLogging(LoggingConstants.DEBUG))
            {
                Log.log(LoggingConstants.DEBUG, "MessageReader::readHeader: name - " + headerName + " mustUnderstand - " + mustUnderstand + " length - " + length);
            }

            return(new Header(headerName, mustUnderstand, length, readData(reader)));
        }
Esempio n. 4
0
        public IAdaptingType read(FlashorbBinaryReader reader, ParseContext parseContext)
        {
            int refId = reader.ReadVarInteger();

            if ((refId & 0x1) == 0)
            {
                return((ArrayType)parseContext.getReference(refId >> 1));
            }

            byte[]          bytes    = reader.ReadBytes(refId >> 1);
            IAdaptingType[] objArray = new IAdaptingType[bytes.Length];

            for (int i = 0; i < bytes.Length; i++)
            {
                objArray[i] = new NumberObject(bytes[i]);
            }

            ArrayType arrayType = new ArrayType(objArray);

            parseContext.addReference(arrayType);
            return(arrayType);
        }