示例#1
0
        public static int getByteArrayLength(Dictionary <String, DateTime> dateMap)
        {
            int blength = 0;

            foreach (KeyValuePair <String, DateTime> item in dateMap)
            {
                // type
                blength += TransferUtil.getLengthOfByte();
                // key
                String key = item.Key;
                blength += TransferUtil.getLengthOfString(key);
                // value
                blength += TransferUtil.getLengthOfDate();
            }
            return(blength);
        }
        public static int getByteArrayLength(Dictionary <String, int[]> intArrayMap)
        {
            int blength = 0;

            foreach (KeyValuePair <String, int[]> item in intArrayMap)
            {
                // type
                blength += TransferUtil.getLengthOfByte();
                // key
                String key = item.Key;
                blength += TransferUtil.getLengthOfString(key);
                // value
                int[] values = item.Value;
                blength += TransferUtil.getLengthOfIntArray(values);
            }
            return(blength);
        }
        public static int getByteArrayLength(Dictionary <String, TransferObjectWrapper> wrapperMap)
        {
            int blength = 0;

            foreach (KeyValuePair <String, TransferObjectWrapper> item in wrapperMap)
            {
                // type
                blength += TransferUtil.getLengthOfByte();
                // key
                String key = item.Key;
                blength += TransferUtil.getLengthOfString(key);
                // value
                TransferObjectWrapper value = item.Value;
                blength += TransferUtil.getLengthOfWrapper(value);
            }
            return(blength);
        }
示例#4
0
        public static int getByteArrayLength(Dictionary <String, String> stringMap)
        {
            int blength = 0;

            foreach (KeyValuePair <String, String> item in stringMap)
            {
                // type
                blength += TransferUtil.getLengthOfByte();
                // key
                String key = item.Key;
                blength += TransferUtil.getLengthOfString(key);
                // value
                String value = item.Value;
                blength += TransferUtil.getLengthOfString(value);
            }
            return(blength);
        }
        private int getByteArrayLength()
        {
            int blength = 0;

            // length of class, method, returnType and compress flag
            blength += TransferUtil.getLengthOfString(calleeClass);
            blength += TransferUtil.getLengthOfString(calleeMethod);
            blength += TransferUtil.getLengthOfByte();
            blength += TransferUtil.getLengthOfByte();

            // length of list data
            foreach (ValueObject vo in paramList)
            {
                if (vo.dataType == DATATYPE_BOOLEAN)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfBoolean();
                }
                else if (vo.dataType == DATATYPE_BYTE)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfByte();
                }
                else if (vo.dataType == DATATYPE_SHORT)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfShort();
                }
                else if (vo.dataType == DATATYPE_CHAR)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfChar();
                }
                else if (vo.dataType == DATATYPE_INT)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfInt();
                }
                else if (vo.dataType == DATATYPE_LONG)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfLong();
                }
                else if (vo.dataType == DATATYPE_FLOAT)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfFloat();
                }
                else if (vo.dataType == DATATYPE_DOUBLE)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfDouble();
                }
                else if (vo.dataType == DATATYPE_DATE)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfDate();
                }
                else if (vo.dataType == DATATYPE_STRING)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfString((string)vo.dataObject);
                }
                else if (vo.dataType == DATATYPE_BYTEARRAY)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfByteArray((byte[])vo.dataObject);
                }
                else if (vo.dataType == DATATYPE_INTARRAY)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfIntArray((int[])vo.dataObject);
                }
                else if (vo.dataType == DATATYPE_LONGARRAY)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfLongArray((long[])vo.dataObject);
                }
                else if (vo.dataType == DATATYPE_FLOATARRAY)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfFloatArray((float[])vo.dataObject);
                }
                else if (vo.dataType == DATATYPE_DOUBLEARRAY)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfDoubleArray((double[])vo.dataObject);
                }
                else if (vo.dataType == DATATYPE_STRINGARRAY)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfStringArray((string[])vo.dataObject);
                }
                else if (vo.dataType == DATATYPE_WRAPPER)
                {
                    blength += TransferUtil.getLengthOfByte() + TransferUtil.getLengthOfWrapper((TransferObjectWrapper)vo.dataObject);
                }
            }

            return(blength);
        }