ReadBytes() public abstract method

Reads a byte array.
public abstract ReadBytes ( ) : byte[]
return byte[]
        /// <summary>
        /// Reads the basic (primitive & Date ) data types
        /// and arrays of them
        /// </summary>
        /// <param name="abstractHessianInput">Hessian Input instance</param>
        /// <exception cref="CHessianException"/>
        /// <returns>Read object</returns>
        public override object ReadObject(AbstractHessianInput abstractHessianInput)
        {
            switch (m_intCode)
            {
                case BOOLEAN:
                    return abstractHessianInput.ReadBoolean();
                case BYTE:
                    return (byte) abstractHessianInput.ReadInt();
                case SBYTE:
                    return (sbyte) abstractHessianInput.ReadInt();
                case FLOAT:
                    return (float) abstractHessianInput.ReadDouble();
                case SHORT:
                    return (short) abstractHessianInput.ReadInt();
                case INTEGER:
                    return abstractHessianInput.ReadInt();
                case LONG:
                    return abstractHessianInput.ReadLong();
                case DOUBLE:
                    return abstractHessianInput.ReadDouble();
                case STRING:
                    return abstractHessianInput.ReadString();
                case CHARACTER:
                {
                    //int charResult = abstractHessianInput.ReadInt();
                    //return (char)charResult;
                    //Bei caucho ist hier ein Bug
                    //TODO:Test
                    string strResult = abstractHessianInput.ReadString();
                    if (strResult == null || strResult.Length==0)
                        return null;
                    else
                        return strResult[0];

                }

                case BOOLEAN_ARRAY:
                case SHORT_ARRAY:
                case INTEGER_ARRAY:
                case SBYTE_ARRAY:
                case LONG_ARRAY:
                case FLOAT_ARRAY:
                case DOUBLE_ARRAY:
                case STRING_ARRAY:
                {
                    if (abstractHessianInput.ReadListStart() == 'N')
                        return null;

                    abstractHessianInput.ReadType();
                    int intLength = abstractHessianInput.ReadLength();

                    return ReadList(abstractHessianInput, intLength);
                }
                case BYTE_ARRAY:
                    return abstractHessianInput.ReadBytes();

                case CHARACTER_ARRAY:
                {
                    string strResult = abstractHessianInput.ReadString();

                    if (strResult == null)
                        return null;
                    else
                    {
                        int intLength= strResult.Length;
                        char [] arrChars = new char[intLength];
                         arrChars = strResult.ToCharArray();
                        return  arrChars;
                    }
                }
                case DATE:
                    long javaTime = abstractHessianInput.ReadUTCDate();
                    return CDateDeserializer.MakeCSharpDate(javaTime);

                default:
                    throw new CHessianException("not supperted type for deserialization");
            }
        }
Example #2
0
        /// <summary>
        /// Reads the basic (primitive & Date ) data types
        /// and arrays of them
        /// </summary>
        /// <param name="abstractHessianInput">Hessian Input instance</param>
        /// <exception cref="CHessianException"/>
        /// <returns>Read object</returns>
        public override object ReadObject(AbstractHessianInput abstractHessianInput)
        {
            switch (m_intCode)
            {
            case BOOLEAN:
                return(abstractHessianInput.ReadBoolean());

            case BYTE:
                return((byte)abstractHessianInput.ReadInt());

            case SBYTE:
                return((sbyte)abstractHessianInput.ReadInt());

            case FLOAT:
                return((float)abstractHessianInput.ReadDouble());

            case SHORT:
                return((short)abstractHessianInput.ReadInt());

            case INTEGER:
                return(abstractHessianInput.ReadInt());

            case LONG:
                return(abstractHessianInput.ReadLong());

            case DOUBLE:
                return(abstractHessianInput.ReadDouble());

            case STRING:
                return(abstractHessianInput.ReadString());

            case CHARACTER:
            {
                //int charResult = abstractHessianInput.ReadInt();
                //return (char)charResult;
                //Bei caucho ist hier ein Bug
                //TODO:Test
                string strResult = abstractHessianInput.ReadString();
                if (strResult == null || strResult.Length == 0)
                {
                    return(null);
                }
                else
                {
                    return(strResult[0]);
                }
            }

            case BOOLEAN_ARRAY:
            case SHORT_ARRAY:
            case INTEGER_ARRAY:
            case SBYTE_ARRAY:
            case LONG_ARRAY:
            case FLOAT_ARRAY:
            case DOUBLE_ARRAY:
            case STRING_ARRAY:
            {
                if (abstractHessianInput.ReadListStart() == 'N')
                {
                    return(null);
                }

                abstractHessianInput.ReadType();
                int intLength = abstractHessianInput.ReadLength();

                return(ReadList(abstractHessianInput, intLength));
            }

            case BYTE_ARRAY:
                return(abstractHessianInput.ReadBytes());

            case CHARACTER_ARRAY:
            {
                string strResult = abstractHessianInput.ReadString();

                if (strResult == null)
                {
                    return(null);
                }
                else
                {
                    int     intLength = strResult.Length;
                    char [] arrChars  = new char[intLength];
                    arrChars = strResult.ToCharArray();
                    return(arrChars);
                }
            }

            case DATE:
                long javaTime = abstractHessianInput.ReadUTCDate();
                return(CDateDeserializer.MakeCSharpDate(javaTime));

            default:
                throw new CHessianException("not supperted type for deserialization");
            }
        }