예제 #1
0
        private object UnpackBlob(int count)
        {
            int type = buffer[offset++];

            count--;
            object val;

            switch (type)
            {
            case ParticleType.STRING:
                val = ByteUtil.Utf8ToString(buffer, offset, count);
                break;

            case ParticleType.CSHARP_BLOB:
                val = ByteUtil.BytesToObject(buffer, offset, count);
                break;

            case ParticleType.GEOJSON:
                val = new Value.GeoJSONValue(ByteUtil.Utf8ToString(buffer, offset, count));
                break;

            default:
                byte[] dest = new byte[count];
                Array.Copy(buffer, offset, dest, 0, count);

                if (lua)
                {
#if NETFRAMEWORK
                    val = new LuaBytes(dest);
#else
                    throw new AerospikeException("Lua not supported in .NET core");
#endif
                }
                else
                {
                    val = dest;
                }
                break;
            }
            offset += count;
            return(val);
        }
예제 #2
0
        private object UnpackBlob(int count)
        {
            int type = buffer[offset++];

            count--;
            object val;

            switch (type)
            {
            case ParticleType.STRING:
                val = ByteUtil.Utf8ToString(buffer, offset, count);
                break;

            case ParticleType.CSHARP_BLOB:
                val = ByteUtil.BytesToObject(buffer, offset, count);
                break;

            case ParticleType.GEOJSON:
                val = new Value.GeoJSONValue(ByteUtil.Utf8ToString(buffer, offset, count));
                break;

            default:
                byte[] dest = new byte[count];
                Array.Copy(buffer, offset, dest, 0, count);

                if (lua)
                {
                    val = new LuaBytes(dest);
                }
                else
                {
                    val = dest;
                }
                break;
            }
            offset += count;
            return(val);
        }