Example #1
0
        public static TransferObject byteArrayToTransferObject(byte[] byteArray)
        {
            //TransferObject to = new TransferObject();
            int receiveLength = byteArray.Length;

            byte[] toByteArray = new byte[receiveLength - 1];
            Array.Copy(byteArray, 1, toByteArray, 0, receiveLength - 1);
            byte flagbyte = byteArray[0];

            TransferObject to = null;

            //check if new version of transfer object
            if (TransferUtil.isNewVersion(flagbyte))
            {
                to = new NewTransferObject();
            }
            else
            {
                to = new StandardTransferObject();
            }

            if (TransferUtil.isCompress(flagbyte))
            {
                toByteArray = TransferUtil.getInputByCompress(toByteArray);
            }
            else
            {
                toByteArray = TransferUtil.getInputByNormal(toByteArray);
            }
            to.setByteData(toByteArray);

            return(to);
        }
Example #2
0
        public static Object byteArrayToReturnObject(byte[] byteArray)
        {
            byte[] toByteArray = new byte[byteArray.Length - 1];
            Array.Copy(byteArray, 1, toByteArray, 0, byteArray.Length - 1);

            if (TransferUtil.isCompress(byteArray[0]))
            {
                toByteArray = TransferUtil.getInputByCompress(toByteArray);
            }
            else
            {
                toByteArray = TransferUtil.getInputByNormal(toByteArray);
            }

            return(TransferObject.convertReturnByteArray(toByteArray));
        }